kopia lustrzana https://github.com/tmsmr/xmpp-webhook
Merge branch 'slack-handler' into master
commit
04686fc587
10
main.go
10
main.go
|
@ -54,14 +54,14 @@ func initXMPP(address jid.JID, pass string, skipTLSVerify bool, useXMPPS bool) (
|
||||||
xmpp.NewNegotiator(xmpp.StreamConfig{Features: []xmpp.StreamFeature{
|
xmpp.NewNegotiator(xmpp.StreamConfig{Features: []xmpp.StreamFeature{
|
||||||
xmpp.BindResource(),
|
xmpp.BindResource(),
|
||||||
xmpp.StartTLS(false, &tlsConfig),
|
xmpp.StartTLS(false, &tlsConfig),
|
||||||
xmpp.SASL("", pass, sasl.ScramSha1Plus, sasl.ScramSha1, sasl.Plain),
|
xmpp.SASL("", pass, sasl.ScramSha256Plus, sasl.ScramSha256, sasl.ScramSha1Plus, sasl.ScramSha1, sasl.Plain),
|
||||||
}}),
|
}}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func closeXMPP(session *xmpp.Session) {
|
func closeXMPP(session *xmpp.Session) {
|
||||||
session.Close()
|
_ = session.Close()
|
||||||
session.Conn().Close()
|
_ = session.Conn().Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -116,6 +116,7 @@ func main() {
|
||||||
Message: stanza.Message{
|
Message: stanza.Message{
|
||||||
To: msg.From.Bare(),
|
To: msg.From.Bare(),
|
||||||
From: address,
|
From: address,
|
||||||
|
Type: stanza.ChatMessage,
|
||||||
},
|
},
|
||||||
Body: msg.Body,
|
Body: msg.Body,
|
||||||
}
|
}
|
||||||
|
@ -141,6 +142,7 @@ func main() {
|
||||||
Message: stanza.Message{
|
Message: stanza.Message{
|
||||||
To: recipient,
|
To: recipient,
|
||||||
From: address,
|
From: address,
|
||||||
|
Type: stanza.ChatMessage,
|
||||||
},
|
},
|
||||||
Body: m,
|
Body: m,
|
||||||
})
|
})
|
||||||
|
@ -153,5 +155,5 @@ func main() {
|
||||||
http.Handle("/slack", newMessageHandler(messages, slackParserFunc))
|
http.Handle("/slack", newMessageHandler(messages, slackParserFunc))
|
||||||
|
|
||||||
// listen for requests
|
// listen for requests
|
||||||
http.ListenAndServe(":4321", nil)
|
_ = http.ListenAndServe(":4321", nil)
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue