1
0
Fork 0
This commit is contained in:
Chteufleur 2015-10-19 21:42:01 +02:00
parent 0a610cf8c8
commit bc9eee01f3
3 changed files with 232 additions and 245 deletions

11
main.go
View File

@ -4,8 +4,8 @@ import (
"go-xmpp4steam/steam" "go-xmpp4steam/steam"
"go-xmpp4steam/xmpp" "go-xmpp4steam/xmpp"
"github.com/jimlawless/cfg"
"github.com/Philipp15b/go-steam/internal/steamlang" "github.com/Philipp15b/go-steam/internal/steamlang"
"github.com/jimlawless/cfg"
"bufio" "bufio"
"log" "log"
@ -63,7 +63,6 @@ func main() {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
} }
// XMPP -> Steam gateways // XMPP -> Steam gateways
func gatewayXmppSteamAction() { func gatewayXmppSteamAction() {
for { for {
@ -116,10 +115,9 @@ func gatewayXmppSteamMessage() {
steam.SendMessage(steamId, message) steam.SendMessage(steamId, message)
} }
} }
// /XMPP -> Steam gateways // /XMPP -> Steam gateways
// Steam -> XMPP gateways // Steam -> XMPP gateways
func gatewaySteamXmppAction() { func gatewaySteamXmppAction() {
for { for {
@ -181,12 +179,9 @@ func gatewaySteamXmppPresence() {
xmpp.SendPresenceFrom(status, tpye, steamId+"@"+xmpp.JidStr) xmpp.SendPresenceFrom(status, tpye, steamId+"@"+xmpp.JidStr)
} }
} }
// /Steam -> XMPP gateways // /Steam -> XMPP gateways
func inputStop() { func inputStop() {
for { for {
in := bufio.NewReader(os.Stdin) in := bufio.NewReader(os.Stdin)

View File

@ -7,9 +7,9 @@ import (
"encoding/json" "encoding/json"
"io/ioutil" "io/ioutil"
"log"
"strconv" "strconv"
"time" "time"
"log"
) )
const ( const (
@ -47,7 +47,6 @@ var (
ChanAction = make(chan string) ChanAction = make(chan string)
) )
func Run() { func Run() {
log.Printf("%sRunning", LogInfo) log.Printf("%sRunning", LogInfo)
setLoginInfos() setLoginInfos()
@ -106,7 +105,6 @@ func mainSteam() {
} }
} }
func setLoginInfos() { func setLoginInfos() {
var sentryHash steam.SentryHash var sentryHash steam.SentryHash
sentryHash, err := ioutil.ReadFile(sentryFile) sentryHash, err := ioutil.ReadFile(sentryFile)
@ -126,7 +124,6 @@ func setLoginInfos() {
} }
} }
func IsConnected() bool { func IsConnected() bool {
return client.Connected() return client.Connected()
} }
@ -155,7 +152,6 @@ func Disconnect() {
go client.Disconnect() go client.Disconnect()
} }
func SendMessage(steamId, message string) { func SendMessage(steamId, message string) {
steamIdUint64, err := strconv.ParseUint(steamId, 10, 64) steamIdUint64, err := strconv.ParseUint(steamId, 10, 64)
if err == nil { if err == nil {
@ -169,8 +165,6 @@ func SendPresence(status steamlang.EPersonaState) {
client.Social.SetPersonaState(status) client.Social.SetPersonaState(status)
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// First authentification error // First authentification error
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -1,6 +1,5 @@
package xmpp package xmpp
import ( import (
// "github.com/emgee/go-xmpp" // "github.com/emgee/go-xmpp"
"go-xmpp" "go-xmpp"
@ -48,7 +47,6 @@ var (
Version = "" Version = ""
) )
func Run() { func Run() {
log.Printf("%sRunning", LogInfo) log.Printf("%sRunning", LogInfo)
// Create stream and configure it as a component connection. // Create stream and configure it as a component connection.