Browse Source

added EChatEntryType enum

pull/41/head
Rossen Georgiev 9 years ago
parent
commit
82c53bcaf0
  1. 4
      steam/client/builtins/user.py
  2. 4
      steam/client/user.py
  3. 17
      steam/enums/common.py

4
steam/client/builtins/user.py

@ -1,6 +1,6 @@
from weakref import WeakValueDictionary from weakref import WeakValueDictionary
from steam.client.user import SteamUser from steam.client.user import SteamUser
from steam.enums import EPersonaState from steam.enums import EPersonaState, EChatEntryType
from steam.enums.emsg import EMsg from steam.enums.emsg import EMsg
from steam.core.msg import MsgProto from steam.core.msg import MsgProto
from steam.util import proto_fill_from_dict from steam.util import proto_fill_from_dict
@ -29,7 +29,7 @@ class User(object):
self.on(EMsg.ClientFriendMsgIncoming, self.__handle_message_incoming) self.on(EMsg.ClientFriendMsgIncoming, self.__handle_message_incoming)
def __handle_message_incoming(self, msg): def __handle_message_incoming(self, msg):
if msg.body.chat_entry_type == 1: if msg.body.chat_entry_type == EChatEntryType.ChatMsg:
user = self.get_user(msg.body.steamid_from) user = self.get_user(msg.body.steamid_from)
self.emit("chat_message", user, msg.body.message) self.emit("chat_message", user, msg.body.message)

4
steam/client/user.py

@ -2,7 +2,7 @@ from datetime import datetime
from binascii import hexlify from binascii import hexlify
from gevent.event import Event from gevent.event import Event
from steam.steamid import SteamID from steam.steamid import SteamID
from steam.enums import EFriendRelationship, EPersonaState from steam.enums import EFriendRelationship, EPersonaState, EChatEntryType
from steam.enums.emsg import EMsg from steam.enums.emsg import EMsg
from steam.core.msg import MsgProto from steam.core.msg import MsgProto
@ -95,6 +95,6 @@ class SteamUser(object):
""" """
self._steam.send(MsgProto(EMsg.ClientFriendMsg), { self._steam.send(MsgProto(EMsg.ClientFriendMsg), {
'steamid': self.steam_id, 'steamid': self.steam_id,
'chat_entry_type': 1, 'chat_entry_type': EChatEntryType.ChatMsg,
'message': message.encode('utf8'), 'message': message.encode('utf8'),
}) })

17
steam/enums/common.py

@ -374,6 +374,23 @@ class ETwoFactorTokenType(SteamIntEnum):
ValveMobileApp = 1 ValveMobileApp = 1
ThirdParty = 2 ThirdParty = 2
class EChatEntryType(SteamIntEnum):
Invalid = 0
ChatMsg = 1
Typing = 2
InviteGame = 3
Emote = 4 # No longer supported by clients
LobbyGameStart = 5 # Listen for LobbyGameCreated_t callback instead
LeftConversation = 6
Entered = 7
WasKicked = 8
WasBanned = 9
Disconnected = 10
HistoricalChat = 11
Reserved1 = 12
Reserved2 = 13
LinkBlocked = 14
# Do not remove # Do not remove
from sys import modules from sys import modules
from enum import EnumMeta from enum import EnumMeta

Loading…
Cancel
Save