Browse Source

set_persona + persona state to online on logon

pull/18/merge
Rossen Georgiev 9 years ago
parent
commit
e39178cd60
  1. 3
      steam/client/__init__.py
  2. 23
      steam/client/features/user.py

3
steam/client/__init__.py

@ -4,7 +4,7 @@ import gevent
from Crypto.Hash import SHA
from eventemitter import EventEmitter
from steam.enums.emsg import EMsg
from steam.enums import EResult, EOSType
from steam.enums import EResult, EOSType, EPersonaState
from steam.core.msg import MsgProto
from steam.core.cm import CMClient
from steam import SteamID
@ -107,6 +107,7 @@ class SteamClient(EventEmitter, FeatureBase):
if result == EResult.OK:
self.logged_on = True
self.set_persona(EPersonaState.Online)
self.emit("logged_on")
return

23
steam/client/features/user.py

@ -1,4 +1,27 @@
from steam.enums import EPersonaState
from steam.enums.emsg import EMsg
from steam.core.msg import MsgProto
class User(object):
def __init__(self):
super(User, self).__init__()
def set_persona(self, state, name=None):
"""
Set persona state and name
:param state: persona state flag
:type state: :class:`steam.enums.common.EPersonaState`
:param name: profile name
:type name: :class:`str`
"""
if not isinstance(state, EPersonaState):
raise ValueError("Expected state to be instance of EPersonaState")
message = MsgProto(EMsg.ClientChangeStatus)
message.body.persona_state = state
if name:
message.body.player_name = name
self.send(message)

Loading…
Cancel
Save