Improved the labeler and bumped the msgpack library to 2.0.0
This commit is contained in:
parent
bf0c946c52
commit
ece9cd8667
@ -138,7 +138,7 @@ subprojects {
|
|||||||
entry 'slf4j-simple'
|
entry 'slf4j-simple'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependency 'ch.dissem.msgpack:msgpack:1.0.0'
|
dependency 'ch.dissem.msgpack:msgpack:2.0.0'
|
||||||
dependency 'org.bouncycastle:bcprov-jdk15on:1.57'
|
dependency 'org.bouncycastle:bcprov-jdk15on:1.57'
|
||||||
dependency 'com.madgag.spongycastle:prov:1.56.0.0'
|
dependency 'com.madgag.spongycastle:prov:1.56.0.0'
|
||||||
dependency 'org.apache.commons:commons-lang3:3.6'
|
dependency 'org.apache.commons:commons-lang3:3.6'
|
||||||
|
@ -156,8 +156,10 @@ open class DefaultMessageListener(
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg.inventoryVector = iv
|
msg.inventoryVector = iv
|
||||||
labeler.setLabels(msg)
|
|
||||||
try {
|
try {
|
||||||
|
ctx.messageRepository.save(msg)
|
||||||
|
// We might need the ID here, so we need to add the labels and save it again
|
||||||
|
labeler.setLabels(msg)
|
||||||
ctx.messageRepository.save(msg)
|
ctx.messageRepository.save(msg)
|
||||||
listener.receive(msg)
|
listener.receive(msg)
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ open class DefaultLabeler : Labeler, InternalContext.ContextHolder {
|
|||||||
msg.status = RECEIVED
|
msg.status = RECEIVED
|
||||||
val labelsToAdd =
|
val labelsToAdd =
|
||||||
if (msg.type == BROADCAST) {
|
if (msg.type == BROADCAST) {
|
||||||
ctx.messageRepository.getLabels(Label.Type.INBOX, Label.Type.BROADCAST, Label.Type.UNREAD)
|
ctx.messageRepository.getLabels(Label.Type.BROADCAST, Label.Type.UNREAD)
|
||||||
} else {
|
} else {
|
||||||
ctx.messageRepository.getLabels(Label.Type.INBOX, Label.Type.UNREAD)
|
ctx.messageRepository.getLabels(Label.Type.INBOX, Label.Type.UNREAD)
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ open class DefaultLabeler : Labeler, InternalContext.ContextHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun delete(msg: Plaintext) {
|
override fun delete(msg: Plaintext) {
|
||||||
val labelsToRemove = msg.labels.filterNot { it.type == Label.Type.TRASH }
|
val labelsToRemove = msg.labels.toSet()
|
||||||
msg.labels.clear()
|
msg.labels.clear()
|
||||||
val labelsToAdd = ctx.messageRepository.getLabels(Label.Type.TRASH)
|
val labelsToAdd = ctx.messageRepository.getLabels(Label.Type.TRASH)
|
||||||
msg.addLabels(labelsToAdd)
|
msg.addLabels(labelsToAdd)
|
||||||
|
Loading…
Reference in New Issue
Block a user