/*
 Eteria IRC Client, an RFC 1459 compliant client program written in Java.
 Copyright (C) 2000-2001  Javier Kohen <jkohen at tough.com>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
 package ar.com.jkohen.irc;
 
 import java.awt.Color;
 
 
 public class User
 {
 	public static final int NORMAL_MASK = 0x01;
 	public static final int OP_MASK	 = 0x02;
 	public static final int HALFOP_MASK = 0x04;
 	public static final int VOICE_MASK  = 0x08;
 	public static final int ADMIN_MASK  = 0x10;
 	public static final int OWNER_MASK  = 0x20;
 	public static final int EXTENDS_MASK  = 0x1000;
 	
 	public static final Color COLOR_OP = new Color(0xAA, 0x00, 0x00);
 	public static final Color COLOR_HOP = new Color(0x00, 0x7F, 0x00);
 	public static final Color COLOR_VOICE = Color.black;
 	public static final Color COLOR_ADMIN = new Color(0xFF, 0x55, 0x55);
 	public static final Color COLOR_OWNER = new Color(0x55, 0x55, 0xFF);
 
 	private String tag;
 	private int modes;
 
 	public User(String tag)
 	{
 		this.modes = Modes.symbolicToMask(tag.charAt(0));
 		this.tag = Modes.canonicalizeNick(tag);
 	}
 
 	public String getTag()
 	{
 		return tag;
 	}
 
 	public void setTag(String tag)
 	{
 		this.tag = tag;
 	}
 
 	public int getModes()
 	{
 		return modes;
 	}
 
 	public void setModes(int modes)
 	{
 		this.modes = modes;
 	}
 
 	public boolean isOp()
 	{
 		return ((modes & OP_MASK) != 0);
 	}
 
 	public boolean isHalfOp()
 	{
 		return ((modes & HALFOP_MASK) != 0);
 	}
 
 	public boolean isVoiced()
 	{
 		return ((modes & VOICE_MASK) != 0);
 	}
 	
 	public boolean isOwner()
 	{
 		return ((modes & OWNER_MASK) != 0);
 	}
 
 	public boolean isAdmin()
 	{
 		return ((modes & ADMIN_MASK) != 0);
 	}
 }