diff --git a/appservice/http.go b/appservice/http.go index 89e1431d..e30c0111 100644 --- a/appservice/http.go +++ b/appservice/http.go @@ -9,6 +9,7 @@ package appservice import ( "context" "encoding/json" + "errors" "io/ioutil" "net/http" "strings" @@ -151,12 +152,10 @@ func (as *AppService) handleEvents(evts []*event.Event, typeClass event.TypeClas evt.Type.Class = event.MessageEventType } err := evt.Content.ParseRaw(evt.Type) - if err != nil { - if evt.ID != "" { - as.Log.Debugfln("Failed to parse content of %s (%s): %v", evt.ID, evt.Type.Type, err) - } else { - as.Log.Debugfln("Failed to parse content of a %s: %v", evt.Type.Type, err) - } + if errors.Is(err, event.UnsupportedContentType) { + as.Log.Debugfln("Not parsing content of %s: %v", evt.ID, err) + } else if err != nil { + as.Log.Debugfln("Failed to parse content of %s (type %s): %v", evt.ID, evt.Type.Type, err) } if evt.Type.IsState() { as.UpdateState(evt) diff --git a/event/content.go b/event/content.go index 18541392..42579ff1 100644 --- a/event/content.go +++ b/event/content.go @@ -145,7 +145,7 @@ func IsUnsupportedContentType(err error) bool { } var ContentAlreadyParsed = errors.New("content is already parsed") -var UnsupportedContentType = errors.New("unsupported content type") +var UnsupportedContentType = errors.New("unsupported event type") func (content *Content) ParseRaw(evtType Type) error { if content.Parsed != nil { diff --git a/event/type.go b/event/type.go index 01b608a1..c6cf8545 100644 --- a/event/type.go +++ b/event/type.go @@ -111,7 +111,9 @@ func (et *Type) GuessClass() TypeClass { return AccountDataEventType case EventRedaction.Type, EventMessage.Type, EventEncrypted.Type, EventReaction.Type, EventSticker.Type, InRoomVerificationStart.Type, InRoomVerificationReady.Type, InRoomVerificationAccept.Type, - InRoomVerificationKey.Type, InRoomVerificationMAC.Type, InRoomVerificationCancel.Type: + InRoomVerificationKey.Type, InRoomVerificationMAC.Type, InRoomVerificationCancel.Type, + CallInvite.Type, CallCandidates.Type, CallAnswer.Type, CallReject.Type, CallSelectAnswer.Type, + CallNegotiate.Type, CallHangup.Type: return MessageEventType case ToDeviceRoomKey.Type, ToDeviceRoomKeyRequest.Type, ToDeviceForwardedRoomKey.Type, ToDeviceRoomKeyWithheld.Type: return ToDeviceEventType