2018-04-11 15:41:51 +00:00
|
|
|
package shhext
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
2018-05-03 07:35:58 +00:00
|
|
|
"github.com/status-im/status-go/signal"
|
2018-04-11 15:41:51 +00:00
|
|
|
)
|
|
|
|
|
2018-04-13 05:52:22 +00: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 07:35:58 +00:00
|
|
|
signal.SendEnvelopeSent(hash)
|
2018-04-13 05:52:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// EnvelopeExpired triggered when envelope is expired but wasn't delivered to any peer.
|
|
|
|
func (h EnvelopeSignalHandler) EnvelopeExpired(hash common.Hash) {
|
2018-05-03 07:35:58 +00:00
|
|
|
signal.SendEnvelopeExpired(hash)
|
2018-04-11 15:41:51 +00:00
|
|
|
}
|
2018-06-15 15:12:31 +00:00
|
|
|
|
2018-07-02 07:38:10 +00: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 15:12:31 +00:00
|
|
|
}
|
|
|
|
|
2018-07-02 07:38:10 +00:00
|
|
|
// MailServerRequestExpired triggered when the mailserver request expires
|
2018-06-15 15:12:31 +00:00
|
|
|
func (h EnvelopeSignalHandler) MailServerRequestExpired(hash common.Hash) {
|
|
|
|
signal.SendMailServerRequestExpired(hash)
|
|
|
|
}
|