modernize message sending
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -24,8 +24,6 @@ profile.cov
|
|||||||
go.work
|
go.work
|
||||||
go.work.sum
|
go.work.sum
|
||||||
|
|
||||||
go.sum
|
|
||||||
|
|
||||||
# env file
|
# env file
|
||||||
.env
|
.env
|
||||||
pi.json
|
pi.json
|
||||||
|
21
main.go
21
main.go
@@ -22,11 +22,10 @@ import (
|
|||||||
catppuccin "github.com/mbaklor/fyne-catppuccin"
|
catppuccin "github.com/mbaklor/fyne-catppuccin"
|
||||||
"mellium.im/xmpp/jid"
|
"mellium.im/xmpp/jid"
|
||||||
"mellium.im/xmpp/muc"
|
"mellium.im/xmpp/muc"
|
||||||
"mellium.im/xmpp/stanza"
|
|
||||||
oasisSdk "pain.agency/oasis-sdk"
|
oasisSdk "pain.agency/oasis-sdk"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version string = "3a"
|
var version string = "3.1a"
|
||||||
|
|
||||||
// by sunglocto
|
// by sunglocto
|
||||||
// license AGPL
|
// license AGPL
|
||||||
@@ -427,22 +426,8 @@ func main() {
|
|||||||
client.ReplyToEvent(&m, text)
|
client.ReplyToEvent(&m, text)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var typ stanza.MessageType
|
|
||||||
if isMuc {
|
err = client.SendText(jid.MustParse(activeMucJid), text)
|
||||||
typ = stanza.GroupChatMessage
|
|
||||||
} else {
|
|
||||||
typ = stanza.ChatMessage
|
|
||||||
}
|
|
||||||
msg := oasisSdk.XMPPChatMessage{
|
|
||||||
Message: stanza.Message{
|
|
||||||
To: jid.MustParse(activeMucJid),
|
|
||||||
Type: typ,
|
|
||||||
},
|
|
||||||
ChatMessageBody: oasisSdk.ChatMessageBody{
|
|
||||||
Body: &text,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
err := client.Session.Encode(client.Ctx, msg)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dialog.ShowError(err, w)
|
dialog.ShowError(err, w)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user