mirror of
https://github.com/FluuxIO/go-xmpp.git
synced 2024-11-21 01:52:01 -08:00
Move project to gosrc.io/xmpp
The URL will be more permanent as this is a place we dedicate as short URL for our go projects.
This commit is contained in:
parent
95585866c2
commit
5eae7f4ef7
@ -1,6 +1,6 @@
|
||||
# Go XMPP library
|
||||
|
||||
[![Codeship Status for FluuxIO/xmpp](https://app.codeship.com/projects/dba7f300-d145-0135-6c51-26e28af241d2/status?branch=master)](https://app.codeship.com/projects/262399) [![GoDoc](https://godoc.org/fluux.io/xmpp?status.svg)](https://godoc.org/fluux.io/xmpp) [![GoReportCard](https://goreportcard.com/badge/fluux.io/xmpp)](https://goreportcard.com/report/fluux.io/xmpp) [![codecov](https://codecov.io/gh/FluuxIO/xmpp/branch/master/graph/badge.svg)](https://codecov.io/gh/FluuxIO/xmpp)
|
||||
[![Codeship Status for FluuxIO/xmpp](https://app.codeship.com/projects/dba7f300-d145-0135-6c51-26e28af241d2/status?branch=master)](https://app.codeship.com/projects/262399) [![GoDoc](https://godoc.org/gosrc.io/xmpp?status.svg)](https://godoc.org/gosrc.io/xmpp) [![GoReportCard](https://goreportcard.com/badge/gosrc.io/xmpp)](https://goreportcard.com/report/fluux.io/xmpp) [![codecov](https://codecov.io/gh/FluuxIO/xmpp/branch/master/graph/badge.svg)](https://codecov.io/gh/FluuxIO/xmpp)
|
||||
|
||||
Fluux XMPP is a Go XMPP library, focusing on simplicity, simple automation, and IoT.
|
||||
|
||||
|
2
auth.go
2
auth.go
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
@ -3,13 +3,13 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"fluux.io/xmpp"
|
||||
"gosrc.io/xmpp"
|
||||
)
|
||||
|
||||
func main() {
|
||||
component := MyComponent{Name: "Test Component", Category: "gateway", Type: "service"}
|
||||
component.xmpp = &xmpp.Component{Host: "service.localhost", Secret: "mypass"}
|
||||
component.xmpp.Connect("localhost:8888")
|
||||
_ = component.xmpp.Connect("localhost:8888")
|
||||
|
||||
for {
|
||||
packet, err := component.xmpp.ReadPacket()
|
||||
@ -39,7 +39,7 @@ func main() {
|
||||
Type: "cancel",
|
||||
}
|
||||
reply := p.MakeError(xError)
|
||||
component.xmpp.Send(&reply)
|
||||
_ = component.xmpp.Send(&reply)
|
||||
}
|
||||
|
||||
case xmpp.Message:
|
||||
@ -83,7 +83,7 @@ func DiscoResult(c MyComponent, attrs xmpp.PacketAttrs, info *xmpp.DiscoInfo) {
|
||||
}
|
||||
iq.AddPayload(&payload)
|
||||
|
||||
c.xmpp.Send(iq)
|
||||
_ = c.xmpp.Send(iq)
|
||||
}
|
||||
|
||||
func DiscoItems(c MyComponent, attrs xmpp.PacketAttrs, items *xmpp.DiscoItems) {
|
||||
@ -98,5 +98,5 @@ func DiscoItems(c MyComponent, attrs xmpp.PacketAttrs, items *xmpp.DiscoItems) {
|
||||
}
|
||||
}
|
||||
iq.AddPayload(&payload)
|
||||
c.xmpp.Send(iq)
|
||||
_ = c.xmpp.Send(iq)
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"fluux.io/xmpp"
|
||||
"gosrc.io/xmpp"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -37,11 +37,11 @@ func main() {
|
||||
for packet := range client.Recv() {
|
||||
switch packet := packet.(type) {
|
||||
case *xmpp.Message:
|
||||
fmt.Fprintf(os.Stdout, "Body = %s - from = %s\n", packet.Body, packet.From)
|
||||
_, _ = fmt.Fprintf(os.Stdout, "Body = %s - from = %s\n", packet.Body, packet.From)
|
||||
reply := xmpp.Message{PacketAttrs: xmpp.PacketAttrs{To: packet.From}, Body: packet.Body}
|
||||
client.Send(reply)
|
||||
_ = client.Send(reply)
|
||||
default:
|
||||
fmt.Fprintf(os.Stdout, "Ignoring packet: %T\n", packet)
|
||||
_, _ = fmt.Fprintf(os.Stdout, "Ignoring packet: %T\n", packet)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,11 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"fluux.io/xmpp"
|
||||
"fluux.io/xmpp/iot"
|
||||
"fluux.io/xmpp/pep"
|
||||
"github.com/processone/mpg123"
|
||||
"github.com/processone/soundcloud"
|
||||
"gosrc.io/xmpp"
|
||||
"gosrc.io/xmpp/iot"
|
||||
"gosrc.io/xmpp/pep"
|
||||
)
|
||||
|
||||
// Get the actual song Stream URL from SoundCloud website song URL and play it with mpg123 player.
|
||||
@ -47,7 +47,7 @@ func main() {
|
||||
case xmpp.Presence:
|
||||
// Do nothing with received presence
|
||||
default:
|
||||
fmt.Fprintf(os.Stdout, "Ignoring packet: %T\n", packet)
|
||||
_, _ = fmt.Fprintf(os.Stdout, "Ignoring packet: %T\n", packet)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,17 +77,17 @@ func processIq(client *xmpp.Client, p *mpg123.Player, packet *xmpp.IQ) {
|
||||
playSCURL(p, url)
|
||||
setResponse := new(iot.ControlSetResponse)
|
||||
reply := xmpp.IQ{PacketAttrs: xmpp.PacketAttrs{To: packet.From, Type: "result", Id: packet.Id}, Payload: []xmpp.IQPayload{setResponse}}
|
||||
client.Send(reply)
|
||||
_ = client.Send(reply)
|
||||
// TODO add Soundclound artist / title retrieval
|
||||
sendUserTune(client, "Radiohead", "Spectre")
|
||||
default:
|
||||
fmt.Fprintf(os.Stdout, "Other IQ Payload: %T\n", packet.Payload)
|
||||
_, _ = fmt.Fprintf(os.Stdout, "Other IQ Payload: %T\n", packet.Payload)
|
||||
}
|
||||
}
|
||||
|
||||
func sendUserTune(client *xmpp.Client, artist string, title string) {
|
||||
tune := pep.Tune{Artist: artist, Title: title}
|
||||
client.SendRaw(tune.XMPPFormat())
|
||||
_ = client.SendRaw(tune.XMPPFormat())
|
||||
}
|
||||
|
||||
func playSCURL(p *mpg123.Player, rawURL string) {
|
||||
@ -95,7 +95,7 @@ func playSCURL(p *mpg123.Player, rawURL string) {
|
||||
// TODO: Maybe we need to check the track itself to get the stream URL from reply ?
|
||||
url := soundcloud.FormatStreamURL(songID)
|
||||
|
||||
p.Play(url)
|
||||
_ = p.Play(url)
|
||||
}
|
||||
|
||||
func connectXmpp(jid string, password string, address string) (client *xmpp.Client, err error) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import "testing"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import "os"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
2
doc.go
2
doc.go
@ -29,4 +29,4 @@ Fluux XMPP has been primarily tested with ejabberd (https://www.ejabberd.im)
|
||||
but it should work with any XMPP compliant server.
|
||||
|
||||
*/
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package iot // import "fluux.io/xmpp/iot"
|
||||
package iot // import "gosrc.io/xmpp/iot"
|
||||
|
||||
import "encoding/xml"
|
||||
|
||||
|
2
iq.go
2
iq.go
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
4
jid.go
4
jid.go
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@ -22,7 +22,7 @@ func NewJid(sjid string) (jid *Jid, err error) {
|
||||
|
||||
s2 := strings.Split(s1[1], "/")
|
||||
if len(s2) > 2 {
|
||||
err = errors.New("invalid JID: " + sjid)
|
||||
err = errors.New("invalid JID: " + sjidd)
|
||||
return
|
||||
}
|
||||
jid.domain = s2[0]
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
2
ns.go
2
ns.go
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
const (
|
||||
NSStream = "http://etherx.jabber.org/streams"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
type Packet interface {
|
||||
Name() string
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package pep // import "fluux.io/xmpp/pep"
|
||||
package pep // import "gosrc.io/xmpp/pep"
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import "encoding/xml"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xmpp // import "fluux.io/xmpp"
|
||||
package xmpp // import "gosrc.io/xmpp"
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
Loading…
Reference in New Issue
Block a user