Exemple #1
0
        void ChatMsg( FriendChatMsg_t chatMsg )
        {
            byte[] msgData = new byte[ 1024 * 4 ];
            EChatEntryType type = EChatEntryType.k_EChatEntryTypeChatMsg;

            CSteamID reciever = new CSteamID( chatMsg.m_ulReceiver );

            int msgLength = steamFriends.GetChatMessage( chatMsg.m_ulReceiver, ( int )chatMsg.m_iChatID, msgData, msgData.Length, ref type );

            if ( type == EChatEntryType.k_EChatEntryTypeTyping )
                return;

            msgLength = Clamp( msgLength, 1, msgData.Length );

            LogMessage log = new LogMessage();

            log.Sender = new CSteamID( chatMsg.m_ulSender );
            log.SenderName = steamFriends.GetFriendPersonaName( log.Sender );

            log.Reciever = reciever;
            log.RecieverName = steamFriends.GetFriendPersonaName( log.Reciever );

            log.Message = Encoding.UTF8.GetString( msgData, 0, msgLength );
            log.Message = log.Message.Substring( 0, log.Message.Length - 1 );
            log.MessageTime = DateTime.Now;
            log.MessageType = type;

            AddLog( log );
        }
Exemple #2
0
        void ChatRoomMsg(ChatRoomMsg_t chatMsg)
        {
            if (!groupChatEnabled || !sets.GroupChatEnabled)
            {
                return;
            }

            byte[]         msgData  = new byte[1024 * 4];
            EChatEntryType chatType = EChatEntryType.k_EChatEntryTypeInvalid;
            ulong          chatter  = 0;

            int len = getChatMsg(clientFriends.Interface, chatMsg.m_ulSteamIDChat, ( int )chatMsg.m_iChatID, ref chatter, msgData, msgData.Length, ref chatType);

            len = Clamp(len, 1, msgData.Length);

            LogMessage log = new LogMessage();

            log.IsGroupMsg   = true;
            log.ChatRoom     = chatMsg.m_ulSteamIDChat;
            log.ChatRoomName = getChatName(clientFriends.Interface, log.ChatRoom);

            log.Sender     = new CSteamID(chatMsg.m_ulSteamIDUser);
            log.SenderName = steamFriends.GetFriendPersonaName(log.Sender);

            log.Reciever     = log.Sender;
            log.RecieverName = log.SenderName;

            log.Message     = Encoding.UTF8.GetString(msgData, 0, len);
            log.Message     = log.Message.Substring(0, log.Message.Length - 1);
            log.MessageTime = DateTime.Now;
            log.MessageType = chatType;

            AddLog(log);
        }