xmpp-webhook

webhook to xmpp gateway (clone of https://github.com/opthomas-prime/xmpp-webhook/ with my own mods)
git clone https://git.e1e0.net/xmpp-webhook.git
Log | Files | Refs | README | LICENSE

commit 6ad06bd237802e018f06f9ae9fdd82dcacdb024b
parent 8e3df4ccb7fa8f93b5021fcc934ae8f59a938eba
Author: Paco Esteban <paco@onna.be>
Date:   Mon, 15 Jul 2019 17:58:49 +0200

bot only answers to its master

Diffstat:
Mmain.go | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/main.go b/main.go @@ -86,11 +86,16 @@ func main() { // check if stanza is a message m, ok := stanza.(*xmpp.Message) if ok && len(m.Body) > 0 { - // echo the message - xc.Out <- xmpp.Message{ - To: m.From, - Body: m.Body, - Type: "chat", + /* echo the message only if it's from me + get first the id from the full From and then check if it's on + the list of XMPP_RECEIVERS */ + fromId := strings.Split(m.From, "/") + if strings.Contains(xr, fromId[0]) { + xc.Out <- xmpp.Message{ + To: m.From, + Body: m.Body, + Type: "chat", + } } } }