Andrea Maria Piana a1b3e3a772
Clean topics that we don't listen to
There was a bug on status-react where it would save filters that were
not listened to.
This commit adds a task to clean up those filters as they might result
in long syncing times.

This commit also returns topics/ranges/mailserves from messenger in
order to make the initialization of the app simpler and start moving
logic to status-go.

It also removes whisper from vendor.
2021-01-26 09:39:57 +01:00

73 lines
1.9 KiB
Go

package mailservers
import "context"
func NewAPI(db *Database) *API {
return &API{db}
}
// API is class with methods available over RPC.
type API struct {
db *Database
}
func (a *API) AddMailserver(ctx context.Context, m Mailserver) error {
return a.db.Add(m)
}
func (a *API) GetMailservers(ctx context.Context) ([]Mailserver, error) {
return a.db.Mailservers()
}
func (a *API) DeleteMailserver(ctx context.Context, id string) error {
return a.db.Delete(id)
}
func (a *API) AddMailserverRequestGaps(ctx context.Context, gaps []MailserverRequestGap) error {
return a.db.AddGaps(gaps)
}
func (a *API) GetMailserverRequestGaps(ctx context.Context, chatID string) ([]MailserverRequestGap, error) {
return a.db.RequestGaps(chatID)
}
func (a *API) DeleteMailserverRequestGaps(ctx context.Context, ids []string) error {
return a.db.DeleteGaps(ids)
}
func (a *API) DeleteMailserverRequestGapsByChatID(ctx context.Context, chatID string) error {
return a.db.DeleteGapsByChatID(chatID)
}
func (a *API) AddMailserverTopic(ctx context.Context, topic MailserverTopic) error {
return a.db.AddTopic(topic)
}
func (a *API) AddMailserverTopics(ctx context.Context, topics []MailserverTopic) error {
return a.db.AddTopics(topics)
}
func (a *API) GetMailserverTopics(ctx context.Context) ([]MailserverTopic, error) {
return a.db.Topics()
}
func (a *API) DeleteMailserverTopic(ctx context.Context, topic string) error {
return a.db.DeleteTopic(topic)
}
func (a *API) AddChatRequestRange(ctx context.Context, req ChatRequestRange) error {
return a.db.AddChatRequestRange(req)
}
func (a *API) AddChatRequestRanges(ctx context.Context, reqs []ChatRequestRange) error {
return a.db.AddChatRequestRanges(reqs)
}
func (a *API) GetChatRequestRanges(ctx context.Context) ([]ChatRequestRange, error) {
return a.db.ChatRequestRanges()
}
func (a *API) DeleteChatRequestRange(ctx context.Context, chatID string) error {
return a.db.DeleteChatRequestRange(chatID)
}