Skip to content

Commit c589550

Browse files
committed
connector: update room capabilities
1 parent 6f2b2fa commit c589550

File tree

1 file changed

+74
-2
lines changed

1 file changed

+74
-2
lines changed

pkg/connector/client.go

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,81 @@ func (c *GChatClient) Connect(ctx context.Context) {
6767
func (c *GChatClient) Disconnect() {
6868
}
6969

70+
// sourced from web client: "Please edit it down to 12000 characters or split over multiple messages."
71+
const maxTextLength = 12000
72+
73+
// ditto
74+
const maxFileSize = 200 * 1024 * 1024
75+
const capId = "fi.mau.googlechat.capabilities.2025_04_29"
76+
7077
var dmCaps = &event.RoomFeatures{
71-
Edit: event.CapLevelFullySupported,
72-
Reply: event.CapLevelFullySupported,
78+
ID: capId,
79+
80+
Formatting: map[event.FormattingFeature]event.CapabilitySupportLevel{
81+
event.FmtBold: event.CapLevelFullySupported,
82+
event.FmtItalic: event.CapLevelFullySupported,
83+
event.FmtStrikethrough: event.CapLevelFullySupported,
84+
event.FmtInlineCode: event.CapLevelFullySupported,
85+
event.FmtCodeBlock: event.CapLevelUnsupported,
86+
event.FmtUserLink: event.CapLevelFullySupported,
87+
event.FmtUnorderedList: event.CapLevelFullySupported,
88+
event.FmtOrderedList: event.CapLevelUnsupported,
89+
event.FmtListStart: event.CapLevelFullySupported,
90+
event.FmtBlockquote: event.CapLevelUnsupported,
91+
92+
// network has support for this, but currently unimplemented
93+
event.FmtInlineLink: event.CapLevelUnsupported,
94+
event.FmtHeaders: event.CapLevelUnsupported,
95+
},
96+
97+
File: event.FileFeatureMap{
98+
event.MsgImage: {
99+
MimeTypes: map[string]event.CapabilitySupportLevel{
100+
"image/png": event.CapLevelFullySupported,
101+
"image/jpeg": event.CapLevelFullySupported,
102+
"image/webp": event.CapLevelFullySupported,
103+
"image/gif": event.CapLevelFullySupported,
104+
},
105+
Caption: event.CapLevelFullySupported,
106+
MaxCaptionLength: maxTextLength,
107+
},
108+
// TODO: event.MsgAudio
109+
// TODO: event.CapMsgVoice
110+
event.CapMsgGIF: {
111+
MimeTypes: map[string]event.CapabilitySupportLevel{
112+
"image/gif": event.CapLevelFullySupported,
113+
// video/mp4?
114+
},
115+
Caption: event.CapLevelFullySupported,
116+
MaxCaptionLength: maxTextLength,
117+
MaxSize: maxFileSize,
118+
},
119+
event.MsgVideo: {
120+
MimeTypes: map[string]event.CapabilitySupportLevel{
121+
"video/mp4": event.CapLevelFullySupported,
122+
},
123+
Caption: event.CapLevelFullySupported,
124+
MaxCaptionLength: maxTextLength,
125+
MaxSize: maxFileSize,
126+
},
127+
event.MsgFile: {
128+
MimeTypes: map[string]event.CapabilitySupportLevel{
129+
"*/*": event.CapLevelFullySupported,
130+
},
131+
Caption: event.CapLevelFullySupported,
132+
MaxCaptionLength: maxTextLength,
133+
MaxSize: maxFileSize,
134+
},
135+
},
136+
137+
MaxTextLength: maxTextLength,
138+
Reply: event.CapLevelFullySupported,
139+
Edit: event.CapLevelFullySupported,
140+
Delete: event.CapLevelFullySupported,
141+
Reaction: event.CapLevelFullySupported,
142+
ReactionCount: 1,
143+
ReadReceipts: true,
144+
TypingNotifications: true,
73145
}
74146

75147
var spaceCaps *event.RoomFeatures

0 commit comments

Comments
 (0)