2018-04-11 18:41:51 +03:00
|
|
|
package shhext
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
2018-05-03 09:35:58 +02:00
|
|
|
"github.com/status-im/status-go/signal"
|
2018-04-11 18:41:51 +03:00
|
|
|
)
|
|
|
|
|
2018-04-13 08:52:22 +03:00
|
|
|
// EnvelopeSignalHandler sends signals when envelope is sent or expired.
|
|
|
|
type EnvelopeSignalHandler struct{}
|
|
|
|
|
|
|
|
// EnvelopeSent triggered when envelope delivered atleast to 1 peer.
|
|
|
|
func (h EnvelopeSignalHandler) EnvelopeSent(hash common.Hash) {
|
2018-05-03 09:35:58 +02:00
|
|
|
signal.SendEnvelopeSent(hash)
|
2018-04-13 08:52:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// EnvelopeExpired triggered when envelope is expired but wasn't delivered to any peer.
|
|
|
|
func (h EnvelopeSignalHandler) EnvelopeExpired(hash common.Hash) {
|
2018-05-03 09:35:58 +02:00
|
|
|
signal.SendEnvelopeExpired(hash)
|
2018-04-11 18:41:51 +03:00
|
|
|
}
|
2018-06-15 17:12:31 +02:00
|
|
|
|
2018-07-02 09:38:10 +02:00
|
|
|
// MailServerRequestCompleted triggered when the mailserver sends a message to notify that the request has been completed
|
|
|
|
func (h EnvelopeSignalHandler) MailServerRequestCompleted(requestID common.Hash, lastEnvelopeHash common.Hash, cursor []byte) {
|
|
|
|
signal.SendMailServerRequestCompleted(requestID, lastEnvelopeHash, cursor)
|
2018-06-15 17:12:31 +02:00
|
|
|
}
|
|
|
|
|
2018-07-02 09:38:10 +02:00
|
|
|
// MailServerRequestExpired triggered when the mailserver request expires
|
2018-06-15 17:12:31 +02:00
|
|
|
func (h EnvelopeSignalHandler) MailServerRequestExpired(hash common.Hash) {
|
|
|
|
signal.SendMailServerRequestExpired(hash)
|
|
|
|
}
|