mirror of
https://github.com/mautrix/whatsapp.git
synced 2026-05-14 17:56:53 -04:00
Compare commits
3 commits
main
...
rnons/bri-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05ca367996 |
||
|
|
f5971eb08c |
||
|
|
04b8d27b5b |
3 changed files with 17 additions and 1 deletions
|
|
@ -340,6 +340,17 @@ func (wa *WhatsAppClient) handleWAMessage(ctx context.Context, evt *events.Messa
|
||||||
evt.Message = decrypted
|
evt.Message = decrypted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if encMessage := evt.Message.GetSecretEncryptedMessage(); encMessage != nil {
|
||||||
|
decrypted, err := wa.Client.DecryptSecretEncryptedMessage(ctx, evt)
|
||||||
|
if err != nil {
|
||||||
|
wa.UserLogin.Log.Err(err).Str("message_id", evt.Info.ID).Msg("Failed to decrypt message")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if decrypted.ProtocolMessage.GetType() == waE2E.ProtocolMessage_MESSAGE_EDIT {
|
||||||
|
parsedMessageType = "edit"
|
||||||
|
}
|
||||||
|
evt.Message = decrypted
|
||||||
|
}
|
||||||
res := wa.UserLogin.QueueRemoteEvent(&WAMessageEvent{
|
res := wa.UserLogin.QueueRemoteEvent(&WAMessageEvent{
|
||||||
MessageInfoWrapper: &MessageInfoWrapper{
|
MessageInfoWrapper: &MessageInfoWrapper{
|
||||||
Info: evt.Info,
|
Info: evt.Info,
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,9 @@ func (mc *MessageConverter) ToMatrix(
|
||||||
part, contextInfo = mc.convertGroupInviteMessage(ctx, info, waMsg.GroupInviteMessage)
|
part, contextInfo = mc.convertGroupInviteMessage(ctx, info, waMsg.GroupInviteMessage)
|
||||||
case waMsg.ProtocolMessage != nil && waMsg.ProtocolMessage.GetType() == waE2E.ProtocolMessage_EPHEMERAL_SETTING:
|
case waMsg.ProtocolMessage != nil && waMsg.ProtocolMessage.GetType() == waE2E.ProtocolMessage_EPHEMERAL_SETTING:
|
||||||
part, contextInfo = mc.convertEphemeralSettingMessage(ctx, waMsg.ProtocolMessage, info.Timestamp, isBackfill)
|
part, contextInfo = mc.convertEphemeralSettingMessage(ctx, waMsg.ProtocolMessage, info.Timestamp, isBackfill)
|
||||||
|
case waMsg.ProtocolMessage != nil && waMsg.ProtocolMessage.GetType() == waE2E.ProtocolMessage_MESSAGE_EDIT:
|
||||||
|
_cm := mc.ToMatrix(ctx, portal, client, intent, waMsg.ProtocolMessage.EditedMessage, nil, info, isViewOnce, nil)
|
||||||
|
part = _cm.Parts[0]
|
||||||
case waMsg.EncCommentMessage != nil:
|
case waMsg.EncCommentMessage != nil:
|
||||||
part = failedCommentPart
|
part = failedCommentPart
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ func (mc *MessageConverter) convertEphemeralSettingMessage(ctx context.Context,
|
||||||
|
|
||||||
const eventMessageTemplate = `
|
const eventMessageTemplate = `
|
||||||
{{- if .Name -}}
|
{{- if .Name -}}
|
||||||
<h4>{{ .Name }}</h4>
|
<h4>{{ .Name }} {{- if .IsCanceled -}}<span> (Canceled)</span>{{- end -}}</h4>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if .StartTime -}}
|
{{- if .StartTime -}}
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -184,6 +184,7 @@ var eventMessageTplParsed = exerrors.Must(template.New("eventmessage").Parse(str
|
||||||
|
|
||||||
type eventMessageParams struct {
|
type eventMessageParams struct {
|
||||||
Name string
|
Name string
|
||||||
|
IsCanceled bool
|
||||||
JoinLink string
|
JoinLink string
|
||||||
StartTimeISO string
|
StartTimeISO string
|
||||||
StartTime string
|
StartTime string
|
||||||
|
|
@ -196,6 +197,7 @@ type eventMessageParams struct {
|
||||||
func (mc *MessageConverter) convertEventMessage(ctx context.Context, msg *waE2E.EventMessage) (*bridgev2.ConvertedMessagePart, *waE2E.ContextInfo) {
|
func (mc *MessageConverter) convertEventMessage(ctx context.Context, msg *waE2E.EventMessage) (*bridgev2.ConvertedMessagePart, *waE2E.ContextInfo) {
|
||||||
params := &eventMessageParams{
|
params := &eventMessageParams{
|
||||||
Name: msg.GetName(),
|
Name: msg.GetName(),
|
||||||
|
IsCanceled: msg.GetIsCanceled(),
|
||||||
JoinLink: msg.GetJoinLink(),
|
JoinLink: msg.GetJoinLink(),
|
||||||
Location: msg.GetLocation().GetName(),
|
Location: msg.GetLocation().GetName(),
|
||||||
DescriptionHTML: template.HTML(parseWAFormattingToHTML(msg.GetDescription(), false)),
|
DescriptionHTML: template.HTML(parseWAFormattingToHTML(msg.GetDescription(), false)),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue