package smserve_main;

import java.util.Vector;

import structures.Message;
import structures.Messagequeue;

public class Userhandler {
	public void addUser(String pMsg){
		String[] msg = pMsg.split(" ");
		Messagequeue queue = new Messagequeue();
		queue.user = msg[1];
		queue.messages = new Vector<Message>();
		smserve_main.SMserve.mails.add(queue);
		synchronized (smserve_main.SMserve.users) {
			smserve_main.SMserve.users.add(msg[1]);
			smserve_main.SMserve.users.add(msg[2]);
		}
	}
	
	public String listUsers(){
		String ret = "";
		for(String _user : smserve_main.SMserve.users){
			ret += _user + ";";
		}
		return ret;
	}
}
