2023-06-30 09:54:08 +00:00
|
|
|
package events
|
|
|
|
|
|
|
|
import (
|
2023-07-15 12:02:03 +00:00
|
|
|
"fmt"
|
2023-07-03 21:03:36 +00:00
|
|
|
"net/http"
|
|
|
|
|
2023-07-17 13:51:31 +00:00
|
|
|
"go.mau.fi/mautrix-gmessages/libgm/gmproto"
|
2023-06-30 09:54:08 +00:00
|
|
|
)
|
|
|
|
|
2023-06-30 13:09:29 +00:00
|
|
|
type ClientReady struct {
|
2023-07-15 23:24:39 +00:00
|
|
|
SessionID string
|
2023-07-17 13:51:31 +00:00
|
|
|
Conversations []*gmproto.Conversation
|
2023-06-30 09:54:08 +00:00
|
|
|
}
|
|
|
|
|
2023-07-17 13:51:31 +00:00
|
|
|
func NewClientReady(sessionID string, conversationList *gmproto.Conversations) *ClientReady {
|
2023-06-30 13:09:29 +00:00
|
|
|
return &ClientReady{
|
2023-07-15 23:24:39 +00:00
|
|
|
SessionID: sessionID,
|
2023-07-09 11:16:52 +00:00
|
|
|
Conversations: conversationList.Conversations,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-16 12:55:30 +00:00
|
|
|
type AuthTokenRefreshed struct{}
|
2023-07-03 21:03:36 +00:00
|
|
|
|
2023-07-15 12:02:03 +00:00
|
|
|
type HTTPError struct {
|
|
|
|
Action string
|
|
|
|
Resp *http.Response
|
|
|
|
}
|
|
|
|
|
|
|
|
func (he HTTPError) Error() string {
|
|
|
|
return fmt.Sprintf("http %d while %s", he.Resp.StatusCode, he.Action)
|
|
|
|
}
|
|
|
|
|
2023-07-03 21:03:36 +00:00
|
|
|
type ListenFatalError struct {
|
2023-07-15 12:02:03 +00:00
|
|
|
Error error
|
2023-07-03 21:03:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ListenTemporaryError struct {
|
|
|
|
Error error
|
|
|
|
}
|
|
|
|
|
|
|
|
type ListenRecovered struct{}
|