Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Moved events to their own files
Browse files Browse the repository at this point in the history
  • Loading branch information
gamingrobot committed Aug 12, 2014
1 parent 75ea9f0 commit 66be42b
Show file tree
Hide file tree
Showing 8 changed files with 435 additions and 419 deletions.
753 changes: 371 additions & 382 deletions client.go

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions client_events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package steam

import (
"github.com/Philipp15b/go-steam/netutil"
)

// When this event is emitted by the Client, the connection is automatically closed.
// This may be caused by a network error, for example.
type FatalErrorEvent error

type ConnectedEvent struct{}

type DisconnectedEvent struct{}

// A list of connection manager addresses to connect to in the future.
// You should always save them and then select one of these
// instead of the builtin ones for the next connection.
type ClientCMListEvent struct {
Addresses []*netutil.PortAddr
}
8 changes: 0 additions & 8 deletions notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ const (
TradeOffer NotificationType = 1
)

// This event is emitted for every CMsgClientUserNotifications message and likewise only used for
// trade offers. Unlike the the above it is also emitted when the count of a type that was tracked
// before by this Notifications instance reaches zero.
type NotificationEvent struct {
Type NotificationType
Count uint
}

func (n *Notifications) handleClientUserNotifications(packet *Packet) {
msg := new(CMsgClientUserNotifications)
packet.ReadProtoMsg(msg)
Expand Down
9 changes: 9 additions & 0 deletions notifications_events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package steam

// This event is emitted for every CMsgClientUserNotifications message and likewise only used for
// trade offers. Unlike the the above it is also emitted when the count of a type that was tracked
// before by this Notifications instance reaches zero.
type NotificationEvent struct {
Type NotificationType
Count uint
}
25 changes: 0 additions & 25 deletions trading.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,6 @@ type Trading struct {

type TradeRequestId uint32

type TradeProposedEvent struct {
RequestId TradeRequestId
Other SteamId
OtherName string
}

type TradeResultEvent struct {
RequestId TradeRequestId
Response EEconTradeResponse
Other SteamId

// Number of days Steam Guard is required to have been active
NumDaysSteamGuardRequired uint32
// Number of days a new device cannot trade for.
NumDaysNewDeviceCooldown uint32
// Default number of days one cannot trade after a password reset.
DefaultNumDaysPasswordResetProbation uint32
// See above.
NumDaysPasswordResetProbation uint32
}

type TradeSessionStartEvent struct {
Other SteamId
}

func (t *Trading) HandlePacket(packet *Packet) {
switch packet.EMsg {
case EMsg_EconTrading_InitiateTradeProposed:
Expand Down
30 changes: 30 additions & 0 deletions trading_events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package steam

import (
. "github.com/Philipp15b/go-steam/internal/steamlang"
. "github.com/Philipp15b/go-steam/steamid"
)

type TradeProposedEvent struct {
RequestId TradeRequestId
Other SteamId `json:",string"`
OtherName string
}

type TradeResultEvent struct {
RequestId TradeRequestId
Response EEconTradeResponse
Other SteamId `json:",string"`
// Number of days Steam Guard is required to have been active
NumDaysSteamGuardRequired uint32
// Number of days a new device cannot trade for.
NumDaysNewDeviceCooldown uint32
// Default number of days one cannot trade after a password reset.
DefaultNumDaysPasswordResetProbation uint32
// See above.
NumDaysPasswordResetProbation uint32
}

type TradeSessionStartEvent struct {
Other SteamId `json:",string"`
}
4 changes: 0 additions & 4 deletions web.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ func (w *Web) HandlePacket(packet *Packet) {
}
}

type WebLoggedOnEvent struct{}

// Fetches the `steamLogin` cookie. This may only be called after the first
// WebSessionIdEvent or it will panic.
func (w *Web) LogOn() {
Expand Down Expand Up @@ -111,8 +109,6 @@ func (w *Web) apiLogOn() error {
return nil
}

type WebSessionIdEvent struct{}

func (w *Web) handleNewLoginKey(packet *Packet) {
msg := new(CMsgClientNewLoginKey)
packet.ReadProtoMsg(msg)
Expand Down
5 changes: 5 additions & 0 deletions web_events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package steam

type WebLoggedOnEvent struct{}

type WebSessionIdEvent struct{}

0 comments on commit 66be42b

Please sign in to comment.