go fmt
This commit is contained in:
parent
0a610cf8c8
commit
bc9eee01f3
31
main.go
31
main.go
|
|
@ -4,8 +4,8 @@ import (
|
|||
"go-xmpp4steam/steam"
|
||||
"go-xmpp4steam/xmpp"
|
||||
|
||||
"github.com/jimlawless/cfg"
|
||||
"github.com/Philipp15b/go-steam/internal/steamlang"
|
||||
"github.com/jimlawless/cfg"
|
||||
|
||||
"bufio"
|
||||
"log"
|
||||
|
|
@ -30,7 +30,7 @@ func init() {
|
|||
}
|
||||
|
||||
// XMPP config
|
||||
xmpp.Addr = mapConfig["xmpp_server_address"]+":"+mapConfig["xmpp_server_port"]
|
||||
xmpp.Addr = mapConfig["xmpp_server_address"] + ":" + mapConfig["xmpp_server_port"]
|
||||
xmpp.JidStr = mapConfig["xmpp_hostname"]
|
||||
xmpp.Secret = mapConfig["xmpp_secret"]
|
||||
xmpp.PreferedJID = mapConfig["xmpp_authorized_jid"]
|
||||
|
|
@ -63,11 +63,10 @@ func main() {
|
|||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
|
||||
|
||||
// XMPP -> Steam gateways
|
||||
func gatewayXmppSteamAction() {
|
||||
for {
|
||||
action := <- xmpp.ChanAction
|
||||
action := <-xmpp.ChanAction
|
||||
|
||||
switch action {
|
||||
case xmpp.ActionConnexion:
|
||||
|
|
@ -85,7 +84,7 @@ func gatewayXmppSteamAction() {
|
|||
|
||||
func gatewayXmppSteamPresence() {
|
||||
for {
|
||||
status := <- xmpp.ChanPresence
|
||||
status := <-xmpp.ChanPresence
|
||||
var steamStatus steamlang.EPersonaState
|
||||
|
||||
switch status {
|
||||
|
|
@ -110,20 +109,19 @@ func gatewayXmppSteamPresence() {
|
|||
|
||||
func gatewayXmppSteamMessage() {
|
||||
for {
|
||||
steamId := <- xmpp.ChanMessage
|
||||
message := <- xmpp.ChanMessage
|
||||
steamId := <-xmpp.ChanMessage
|
||||
message := <-xmpp.ChanMessage
|
||||
|
||||
steam.SendMessage(steamId, message)
|
||||
}
|
||||
}
|
||||
|
||||
// /XMPP -> Steam gateways
|
||||
|
||||
|
||||
|
||||
// Steam -> XMPP gateways
|
||||
func gatewaySteamXmppAction() {
|
||||
for {
|
||||
action := <- steam.ChanAction
|
||||
action := <-steam.ChanAction
|
||||
switch action {
|
||||
case steam.ActionConnected:
|
||||
xmpp.SendPresence(xmpp.CurrentStatus, xmpp.Type_available)
|
||||
|
|
@ -140,8 +138,8 @@ func gatewaySteamXmppAction() {
|
|||
|
||||
func gatewaySteamXmppMessage() {
|
||||
for {
|
||||
steamId := <- steam.ChanMessage
|
||||
message := <- steam.ChanMessage
|
||||
steamId := <-steam.ChanMessage
|
||||
message := <-steam.ChanMessage
|
||||
xmpp.SendMessage(steamId+"@"+xmpp.JidStr, message)
|
||||
}
|
||||
}
|
||||
|
|
@ -149,8 +147,8 @@ func gatewaySteamXmppMessage() {
|
|||
func gatewaySteamXmppPresence() {
|
||||
for {
|
||||
// name := steam.ChanPresence
|
||||
steamId := <- steam.ChanPresence
|
||||
stat := <- steam.ChanPresenceSteam
|
||||
steamId := <-steam.ChanPresence
|
||||
stat := <-steam.ChanPresenceSteam
|
||||
|
||||
SetSteamId[steamId] = struct{}{}
|
||||
|
||||
|
|
@ -181,12 +179,9 @@ func gatewaySteamXmppPresence() {
|
|||
xmpp.SendPresenceFrom(status, tpye, steamId+"@"+xmpp.JidStr)
|
||||
}
|
||||
}
|
||||
|
||||
// /Steam -> XMPP gateways
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func inputStop() {
|
||||
for {
|
||||
in := bufio.NewReader(os.Stdin)
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import (
|
|||
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"strconv"
|
||||
"time"
|
||||
"log"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -47,7 +47,6 @@ var (
|
|||
ChanAction = make(chan string)
|
||||
)
|
||||
|
||||
|
||||
func Run() {
|
||||
log.Printf("%sRunning", LogInfo)
|
||||
setLoginInfos()
|
||||
|
|
@ -106,7 +105,6 @@ func mainSteam() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
func setLoginInfos() {
|
||||
var sentryHash steam.SentryHash
|
||||
sentryHash, err := ioutil.ReadFile(sentryFile)
|
||||
|
|
@ -126,7 +124,6 @@ func setLoginInfos() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
func IsConnected() bool {
|
||||
return client.Connected()
|
||||
}
|
||||
|
|
@ -155,7 +152,6 @@ func Disconnect() {
|
|||
go client.Disconnect()
|
||||
}
|
||||
|
||||
|
||||
func SendMessage(steamId, message string) {
|
||||
steamIdUint64, err := strconv.ParseUint(steamId, 10, 64)
|
||||
if err == nil {
|
||||
|
|
@ -169,8 +165,6 @@ func SendPresence(status steamlang.EPersonaState) {
|
|||
client.Social.SetPersonaState(status)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// First authentification error
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package xmpp
|
||||
|
||||
|
||||
import (
|
||||
// "github.com/emgee/go-xmpp"
|
||||
"go-xmpp"
|
||||
|
|
@ -48,7 +47,6 @@ var (
|
|||
Version = ""
|
||||
)
|
||||
|
||||
|
||||
func Run() {
|
||||
log.Printf("%sRunning", LogInfo)
|
||||
// Create stream and configure it as a component connection.
|
||||
|
|
@ -104,7 +102,7 @@ func Disconnect() {
|
|||
}
|
||||
|
||||
func SendPresence(status, tpye string) {
|
||||
comp.Out <- xmpp.Presence{To: PreferedJID, From: jid.Domain, Show: status, Type: tpye, Status: "go-xmpp4steam v"+Version}
|
||||
comp.Out <- xmpp.Presence{To: PreferedJID, From: jid.Domain, Show: status, Type: tpye, Status: "go-xmpp4steam v" + Version}
|
||||
}
|
||||
|
||||
func SendPresenceFrom(status, tpye, from string) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue