Пример #1
0
        private static void CheckForUnknownUserOrRoom(CampfireState campfireInfo, Message msg, ICampfireAPI api)
        {
            // If this userId isn't already known...
            if (!campfireInfo.IsUserKnown(msg.UserId))
            {
                // fetch all the user Info and then add
                User newUser = api.GetUser(msg.UserId);
                if ((newUser != null) && (newUser.Type == User.UserType.Member) && !string.IsNullOrEmpty(newUser.Name) && !string.IsNullOrEmpty(newUser.Email))
                {
                    Utils.TraceVerboseMessage(string.Format("Found a new User: {0}, Id: {1}", newUser.Name, newUser.Id));
                    campfireInfo.AddUser(newUser.Id, newUser.Name, newUser.Email, string.Empty);
                }
            }

            // If this roomId isn't already known...
            if (!campfireInfo.IsRoomKnown(msg.RoomId))
            {
                // fetch all the user Info and then add
                Room newRoom = api.GetRoom(msg.RoomId);
                if (newRoom != null)
                {
                    Utils.TraceVerboseMessage(string.Format("Found a new Room: {0}, Id: {1}", newRoom.Name, newRoom.Id));
                    campfireInfo.AddRoom(newRoom.Id, newRoom.Name, 0);
                }
            }
        }
Пример #2
0
        private static void CheckForUnknownUserOrRoom(CampfireState campfireInfo, Message msg, ICampfireAPI api)
        {
            // If this userId isn't already known...
            if (!campfireInfo.IsUserKnown(msg.UserId))
            {
                // fetch all the user Info and then add
                User newUser = api.GetUser(msg.UserId);
                if ((newUser != null) && (newUser.Type == User.UserType.Member) && !string.IsNullOrEmpty(newUser.Name) && !string.IsNullOrEmpty(newUser.Email))
                {
                    Utils.TraceVerboseMessage(string.Format("Found a new User: {0}, Id: {1}", newUser.Name, newUser.Id));
                    campfireInfo.AddUser(newUser.Id, newUser.Name, newUser.Email, string.Empty);
                }
            }

            // If this roomId isn't already known...
            if (!campfireInfo.IsRoomKnown(msg.RoomId))
            {
                // fetch all the user Info and then add
                Room newRoom = api.GetRoom(msg.RoomId);
                if (newRoom != null)
                {
                    Utils.TraceVerboseMessage(string.Format("Found a new Room: {0}, Id: {1}", newRoom.Name, newRoom.Id));
                    campfireInfo.AddRoom(newRoom.Id, newRoom.Name, 0);
                }
            }
        }