Skip to content

Commit

Permalink
Merge pull request Philipp15b#107 from Jleagle/master
Browse files Browse the repository at this point in the history
Fix build
  • Loading branch information
Philipp15b authored Jul 27, 2020
2 parents 3de3d75 + a947048 commit ab78429
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 20 deletions.
4 changes: 2 additions & 2 deletions auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ func (a *Auth) handleLogOnResponse(packet *Packet) {
ExtendedResult: EResult(body.GetEresultExtended()),
OutOfGameSecsPerHeartbeat: body.GetOutOfGameHeartbeatSeconds(),
InGameSecsPerHeartbeat: body.GetInGameHeartbeatSeconds(),
PublicIp: body.GetPublicIp(),
PublicIp: body.GetDeprecatedPublicIp(),
ServerTime: body.GetRtime32ServerTime(),
AccountFlags: EAccountFlags(body.GetAccountFlags()),
ClientSteamId: SteamId(body.GetClientSuppliedSteamid()),
EmailDomain: body.GetEmailDomain(),
CellId: body.GetCellId(),
CellIdPingThreshold: body.GetCellIdPingThreshold(),
Steam2Ticket: body.GetSteam2Ticket(),
UsePics: body.GetUsePics(),
UsePics: body.GetDeprecatedUsePics(),
WebApiUserNonce: body.GetWebapiAuthenticateUserNonce(),
IpCountryCode: body.GetIpCountryCode(),
VanityUrl: body.GetVanityUrl(),
Expand Down
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module github.com/Philipp15b/go-steam

go 1.14

require (
github.com/davecgh/go-spew v1.1.1
github.com/golang/protobuf v1.4.2
)
22 changes: 22 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
6 changes: 3 additions & 3 deletions gsbot/gsbot/gsbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ func main() {
bot := gsbot.Default()
client := bot.Client
auth := gsbot.NewAuth(bot, &gsbot.LogOnDetails{
os.Args[1],
os.Args[2],
authcode,
Username: os.Args[1],
Password: os.Args[2],
AuthCode: authcode,
}, "sentry.bin")
debug, err := gsbot.NewDebug(bot, "debug")
if err != nil {
Expand Down
27 changes: 13 additions & 14 deletions social.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ func (s *Social) SetPersonaState(state EPersonaState) {

// Sends a chat message to ether a room or friend
func (s *Social) SendMessage(to SteamId, entryType EChatEntryType, message string) {
//Friend
// Friend
if to.GetAccountType() == int32(EAccountType_Individual) || to.GetAccountType() == int32(EAccountType_ConsoleUser) {
s.client.Write(NewClientMsgProtobuf(EMsg_ClientFriendMsg, &CMsgClientFriendMsg{
Steamid: proto.Uint64(to.ToUint64()),
ChatEntryType: proto.Int32(int32(entryType)),
Message: []byte(message),
}))
//Chat room
// Chat room
} else if to.GetAccountType() == int32(EAccountType_Clan) || to.GetAccountType() == int32(EAccountType_Chat) {
chatId := to.ClanToChat()
s.client.Write(NewClientMsg(&MsgClientChatMsg{
Expand Down Expand Up @@ -119,9 +119,9 @@ func (s *Social) RemoveFriend(id SteamId) {

// Ignores or unignores a friend on Steam
func (s *Social) IgnoreFriend(id SteamId, setIgnore bool) {
ignore := uint8(1) //True
ignore := uint8(1) // True
if !setIgnore {
ignore = uint8(0) //False
ignore = uint8(0) // False
}
s.client.Write(NewClientMsg(&MsgClientSetIgnoreFriend{
MySteamId: s.client.SteamId(),
Expand Down Expand Up @@ -244,7 +244,7 @@ func (s *Social) HandlePacket(packet *Packet) {
}

func (s *Social) handleAccountInfo(packet *Packet) {
//Just fire the personainfo, Auth handles the callback
// Just fire the personainfo, Auth handles the callback
flags := EClientPersonaStateFlag_PlayerName | EClientPersonaStateFlag_Presence | EClientPersonaStateFlag_SourceID
s.RequestFriendInfo(s.client.SteamId(), EClientPersonaStateFlag(flags))
}
Expand Down Expand Up @@ -302,7 +302,7 @@ func (s *Social) handlePersonaState(packet *Packet) {
flags := EClientPersonaStateFlag(list.GetStatusFlags())
for _, friend := range list.GetFriends() {
id := SteamId(friend.GetFriendid())
if id == s.client.SteamId() { //this is our client id
if id == s.client.SteamId() { // this is our client id
s.mutex.Lock()
if friend.GetPlayerName() != "" {
s.name = friend.GetPlayerName()
Expand Down Expand Up @@ -364,7 +364,6 @@ func (s *Social) handlePersonaState(packet *Packet) {
ClanRank: friend.GetClanRank(),
ClanTag: friend.GetClanTag(),
OnlineSessionInstances: friend.GetOnlineSessionInstances(),
PublishedSessionId: friend.GetPublishedInstanceId(),
PersonaSetByUser: friend.GetPersonaSetByUser(),
})
}
Expand Down Expand Up @@ -407,7 +406,7 @@ func (s *Social) handleClanState(packet *Packet) {
})
}

//Add stuff to group
// Add stuff to group
clanid := SteamId(body.GetSteamidClan())
if body.NameInfo != nil {
info := body.NameInfo
Expand Down Expand Up @@ -473,14 +472,14 @@ func (s *Social) handleChatEnter(packet *Packet) {
payload := packet.ReadClientMsg(body).Payload
reader := bytes.NewBuffer(payload)
name, _ := ReadString(reader)
ReadByte(reader) //0
ReadByte(reader) // 0
count := body.NumMembers
chatId := SteamId(body.SteamIdChat)
clanId := SteamId(body.SteamIdClan)
s.Chats.Add(socialcache.Chat{SteamId: chatId, GroupId: clanId})
for i := 0; i < int(count); i++ {
id, chatPerm, clanPerm := readChatMember(reader)
ReadBytes(reader, 6) //No idea what this is
ReadBytes(reader, 6) // No idea what this is
s.Chats.AddChatMember(chatId, socialcache.ChatMember{
SteamId: SteamId(id),
ChatPermissions: chatPerm,
Expand Down Expand Up @@ -508,7 +507,7 @@ func (s *Social) handleChatMemberInfo(packet *Packet) {
actedOn, _ := ReadUint64(reader)
state, _ := ReadInt32(reader)
actedBy, _ := ReadUint64(reader)
ReadByte(reader) //0
ReadByte(reader) // 0
stateChange := EChatMemberStateChange(state)
if stateChange == EChatMemberStateChange_Entered {
_, chatPerm, clanPerm := readChatMember(reader)
Expand Down Expand Up @@ -537,13 +536,13 @@ func (s *Social) handleChatMemberInfo(packet *Packet) {
func readChatMember(r io.Reader) (SteamId, EChatPermission, EClanPermission) {
ReadString(r) // MessageObject
ReadByte(r) // 7
ReadString(r) //steamid
ReadString(r) // steamid
id, _ := ReadUint64(r)
ReadByte(r) // 2
ReadString(r) //Permissions
ReadString(r) // Permissions
chat, _ := ReadInt32(r)
ReadByte(r) // 2
ReadString(r) //Details
ReadString(r) // Details
clan, _ := ReadInt32(r)
return SteamId(id), EChatPermission(chat), EClanPermission(clan)
}
Expand Down
1 change: 0 additions & 1 deletion social_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ type PersonaStateEvent struct {
ClanRank uint32
ClanTag string
OnlineSessionInstances uint32
PublishedSessionId uint32
PersonaSetByUser bool
}

Expand Down

0 comments on commit ab78429

Please sign in to comment.