// Path: src/skype/utils/users/UserInformation.java
// public class UserInformation {
// 
// 	private MutableLong warnings = new MutableLong(0);
// 	
// 	private MutableLong messagesToday = new MutableLong(0);
// 	
// 	private MutableLong commandsToday = new MutableLong(0);
// 
// 	private ChatMessage lastMessage = null;
// 	
// 	/**
// 	 * When the last message was sent. We use that field because
// 	 * {@link ChatMessage#getTime()} has low resolution.
// 	 */
// 	private Long lastMessageTime = null;
// 
// 	/** The user for whom we keep all that informations. */
// 	private final User user;
// 
// 	private final WarningsReseters warningsReseter = new WarningsReseters(warnings);
// 	
// 	private final DailyReseter messagesReseter = new DailyReseter(messagesToday, getMidnight());
// 	
// 	private final DailyReseter commandsReseter = new DailyReseter(commandsToday, getMidnight());
// 
// 	public UserInformation(User user) {
// 		this.user = user;
// 		warningsReseter.startTimer();
// 		messagesReseter.startTimer();
// 		commandsReseter.startTimer();
// 	}
// 	
// 	public void increaseWarning(){
// 		warnings.increment();
// 	}
// 	
// 	public void increaseTotalMessagesToday(){
// 		messagesToday.increment();
// 	}
// 	
// 	public void increaseTotalCommandsToday() {
// 		commandsToday.increment();
// 	}
// 
// 	public void decreaseTotalCommandsToday() {
// 		commandsToday.decrement();
// 	}
// 
// 	public Long getTotalCommands() {
// 		return commandsToday.toLong();
// 	}
// 
// 	public Long getWarnings() {
// 		return warnings.toLong();
// 	}
// 	
// 	public void ResetWarnings() {
// 		warnings.setValue(0);
// 	}
// 
// 	public Long getTotalMessagesToday() {
// 		return messagesToday.toLong();
// 	}
// 	
// 	public ChatMessage getLastMessage() {
// 		return lastMessage;
// 	}
// 
// 	public void setLastMessage(ChatMessage msg, Long sentTime) {
// 		lastMessage = msg;
// 		lastMessageTime = sentTime;
// 	}
// 	
// 	public Long getLastMessageTime() {
// 		return lastMessageTime;
// 	}
// 
// 	public User getUser(){
// 		return user;
// 	}
// 
// }


import java.util.concurrent.ConcurrentHashMap;
import com.skype.ChatListener;
import com.skype.User;
import skype.utils.users.UserInformation;
/*
 *    Copyright [2016] [Thanasis Argyroudis]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package skype.listeners;




/**
 * The Class GroupChatMemberManager. This class is responsible for updating the users
 * of one registered chat. It modifies {@link #users} based on if an user left or
 * entered the chat.
 *
 * @author Thanasis Argyroudis
 * @since 1.0
 */
public class GroupChatMemberManager implements ChatListener {

	/** A reference to {@link skype.listeners.GroupChatListener#users}. */
	private final ConcurrentHashMap<String, UserInformation> users;

	/**
	 * Instantiates a new group chat member manager.
	 *
	 * @param users
	 *            reference to users of a group.
	 */
	public GroupChatMemberManager(ConcurrentHashMap<String, UserInformation> users) {
		this.users = users;
	}

	@Override
	public void userAdded(User u) {
// Path: src/skype/utils/users/UserInformation.java
// public class UserInformation {
// 
// 	private MutableLong warnings = new MutableLong(0);
// 	
// 	private MutableLong messagesToday = new MutableLong(0);
// 	
// 	private MutableLong commandsToday = new MutableLong(0);
// 
// 	private ChatMessage lastMessage = null;
// 	
// 	/**
// 	 * When the last message was sent. We use that field because
// 	 * {@link ChatMessage#getTime()} has low resolution.
// 	 */
// 	private Long lastMessageTime = null;
// 
// 	/** The user for whom we keep all that informations. */
// 	private final User user;
// 
// 	private final WarningsReseters warningsReseter = new WarningsReseters(warnings);
// 	
// 	private final DailyReseter messagesReseter = new DailyReseter(messagesToday, getMidnight());
// 	
// 	private final DailyReseter commandsReseter = new DailyReseter(commandsToday, getMidnight());
// 
// 	public UserInformation(User user) {
// 		this.user = user;
// 		warningsReseter.startTimer();
// 		messagesReseter.startTimer();
// 		commandsReseter.startTimer();
// 	}
// 	
// 	public void increaseWarning(){
// 		warnings.increment();
// 	}
// 	
// 	public void increaseTotalMessagesToday(){
// 		messagesToday.increment();
// 	}
// 	
// 	public void increaseTotalCommandsToday() {
// 		commandsToday.increment();
// 	}
// 
// 	public void decreaseTotalCommandsToday() {
// 		commandsToday.decrement();
// 	}
// 
// 	public Long getTotalCommands() {
// 		return commandsToday.toLong();
// 	}
// 
// 	public Long getWarnings() {
// 		return warnings.toLong();
// 	}
// 	
// 	public void ResetWarnings() {
// 		warnings.setValue(0);
// 	}
// 
// 	public Long getTotalMessagesToday() {
// 		return messagesToday.toLong();
// 	}
// 	
// 	public ChatMessage getLastMessage() {
// 		return lastMessage;
// 	}
// 
// 	public void setLastMessage(ChatMessage msg, Long sentTime) {
// 		lastMessage = msg;
// 		lastMessageTime = sentTime;
// 	}
// 	
// 	public Long getLastMessageTime() {
// 		return lastMessageTime;
// 	}
// 
// 	public User getUser(){
// 		return user;
// 	}
// 
// }


// Path: src/skype/listeners/GroupChatMemberManager.java
import java.util.concurrent.ConcurrentHashMap;
import com.skype.ChatListener;
import com.skype.User;
import skype.utils.users.UserInformation;

/*
 *    Copyright [2016] [Thanasis Argyroudis]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package skype.listeners;




/**
 * The Class GroupChatMemberManager. This class is responsible for updating the users
 * of one registered chat. It modifies {@link #users} based on if an user left or
 * entered the chat.
 *
 * @author Thanasis Argyroudis
 * @since 1.0
 */
public class GroupChatMemberManager implements ChatListener {

	/** A reference to {@link skype.listeners.GroupChatListener#users}. */
	private final ConcurrentHashMap<String, UserInformation> users;

	/**
	 * Instantiates a new group chat member manager.
	 *
	 * @param users
	 *            reference to users of a group.
	 */
	public GroupChatMemberManager(ConcurrentHashMap<String, UserInformation> users) {
		this.users = users;
	}

	@Override
	public void userAdded(User u) {
		users.put(u.getId(), new UserInformation(u));