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.
|
2019-04-02 10:40:45 +00:00
|
|
|
func (h EnvelopeSignalHandler) EnvelopeExpired(hash common.Hash, err error) {
|
|
|
|
signal.SendEnvelopeExpired(hash, err)
|
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
|
2018-10-18 10:25:00 +00:00
|
|
|
func (h EnvelopeSignalHandler) MailServerRequestCompleted(requestID common.Hash, lastEnvelopeHash common.Hash, cursor []byte, err error) {
|
|
|
|
signal.SendMailServerRequestCompleted(requestID, lastEnvelopeHash, cursor, err)
|
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)
|
|
|
|
}
|
2019-07-01 09:39:51 +00:00
|
|
|
|
|
|
|
// PublisherSignalHandler sends signals on protocol events
|
|
|
|
type PublisherSignalHandler struct{}
|
|
|
|
|
|
|
|
func (h PublisherSignalHandler) DecryptMessageFailed(pubKey string) {
|
|
|
|
signal.SendDecryptMessageFailed(pubKey)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h PublisherSignalHandler) BundleAdded(identity string, installationID string) {
|
|
|
|
signal.SendBundleAdded(identity, installationID)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h PublisherSignalHandler) WhisperFilterAdded(filters []*signal.Filter) {
|
|
|
|
signal.SendWhisperFilterAdded(filters)
|
|
|
|
}
|