Support delete events from Mastodon

This commit is contained in:
Christian Muehlhaeuser 2019-05-23 15:24:37 +02:00
parent 0487a7bd15
commit 073406a234
No known key found for this signature in database
GPG key ID: 3CF9FA45CA1EBB7E
3 changed files with 16 additions and 0 deletions

View file

@ -84,6 +84,10 @@ type LoginEvent struct {
PostSizeLimit int64 PostSizeLimit int64
} }
type DeleteEvent struct {
ID string
}
// ErrorEvent describes an error that occurred. // ErrorEvent describes an error that occurred.
type ErrorEvent struct { type ErrorEvent struct {
Message string Message string

View file

@ -644,6 +644,14 @@ func (mod *Account) handleStreamEvent(item interface{}, ch chan interface{}) {
case *mastodon.UpdateEvent: case *mastodon.UpdateEvent:
ch <- mod.handleStatus(e.Status) ch <- mod.handleStatus(e.Status)
case *mastodon.DeleteEvent:
mod.evchan <- accounts.DeleteEvent{
ID: string(e.ID),
}
default:
fmt.Printf("Unknown event: %+v\n", item)
} }
} }

View file

@ -44,6 +44,10 @@ func handleEvents(eventsIn chan interface{}, messages *MessageModel) {
p.Preview = event.Preview p.Preview = event.Preview
attachmentModel.AddAttachment(p) attachmentModel.AddAttachment(p)
} }
case accounts.DeleteEvent:
{
deleteMessage(event.ID)
}
case accounts.MessageEvent: case accounts.MessageEvent:
{ {
// spw := &spew.ConfigState{Indent: " ", DisableCapacities: true, DisablePointerAddresses: true} // spw := &spew.ConfigState{Indent: " ", DisableCapacities: true, DisablePointerAddresses: true}