bug fix for conversation/direct

This commit is contained in:
Rasmus Lindroth 2022-12-30 10:45:58 +01:00
parent 9faaa4f0dc
commit aa9c1859b5
4 changed files with 45 additions and 4 deletions

View file

@ -39,6 +39,13 @@ type DeleteEvent struct{ ID ID }
func (e *DeleteEvent) event() {}
// ConversationEvent is a struct for passing conversationevent to app.
type ConversationEvent struct {
Conversation *Conversation `json:"conversation"`
}
func (e *ConversationEvent) event() {}
// ErrorEvent is a struct for passing errors to app.
type ErrorEvent struct{ err error }
@ -100,6 +107,12 @@ func handleReader(q chan Event, r io.Reader) error {
if err == nil {
q <- &NotificationEvent{&notification}
}
case "conversation":
var conversation Conversation
err = json.Unmarshal([]byte(token[1]), &conversation)
if err == nil {
q <- &ConversationEvent{&conversation}
}
case "delete":
q <- &DeleteEvent{ID: ID(strings.TrimSpace(token[1]))}
}