package heufybot.core;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

public class ServerInfo 
{
	//TODO Add more server info
	
	private String motd, network, chantypes;
	private LinkedHashMap<String, String> userPrefixes;
	private LinkedHashMap<String, String> reverseUserPrefixes;
	private List<String> channelListModes, channelSetArgsModes, channelSetUnsetArgsModes, channelNoArgsModes;
	
	private static final ServerInfo instance = new ServerInfo();
	
	private ServerInfo()
	{
		clear();
	}
	
	public static ServerInfo getInstance()
	{
		return instance;
	}
	
	public void clear()
	{
		this.userPrefixes = new LinkedHashMap<String, String>();
		this.reverseUserPrefixes = new LinkedHashMap<String, String>();
		
		//Initialize user prefixes with default values (@ for op (o) and + for voice (v))
		userPrefixes.put("o", "@");
		userPrefixes.put("v", "+");
		
		reverseUserPrefixes.put("@", "o");
		reverseUserPrefixes.put("+", "v");	
		
		this.channelListModes = new ArrayList<String>();
		this.channelSetArgsModes = new ArrayList<String>();
		this.channelSetUnsetArgsModes = new ArrayList<String>();
		this.channelNoArgsModes = new ArrayList<String>();
		
		this.chantypes = "#";
		this.network = "Unknown Network";
	}
	
	public String getMotd()
	{
		return motd;
	}

	public void setMotd(String motd) 
	{
		this.motd = motd;
	}
	
	public void appendMotd(String motd)
	{
		this.motd += motd;
	}

	public LinkedHashMap<String, String> getUserPrefixes()
	{
		return userPrefixes;
	}

	public void setUserPrefixes(LinkedHashMap<String, String> userPrefixes) 
	{
		this.userPrefixes = userPrefixes;
	}

	public LinkedHashMap<String, String> getReverseUserPrefixes() 
	{
		return reverseUserPrefixes;
	}

	public void setReverseUserPrefixes(LinkedHashMap<String, String> reverseUserPrefixes)
	{
		this.reverseUserPrefixes = reverseUserPrefixes;
	}

	public String getNetwork()
	{
		return network;
	}

	public void setNetwork(String network)
	{
		this.network = network;
	}
	
	public List<String> getChannelListModes()
	{
		return channelListModes;
	}
	
	public List<String> getChannelSetArgsModes()
	{
		return channelSetArgsModes;
	}
	
	public List<String> getChannelSetUnsetArgsModes()
	{
		return channelSetUnsetArgsModes;
	}
	
	public List<String> getChannelNoArgsModes()
	{
		return channelNoArgsModes;
	}

	public String getChantypes() 
	{
		return chantypes;
	}

	public void setChantypes(String chantypes) 
	{
		this.chantypes = chantypes;
	}
}
@@ -28,29 +28,37 @@
 ort 
-java.util.ArrayList
+heufybot.utils.StringUtils
 ;%0A
+%0A
 impo
@@ -427,16 +427,27 @@
 rgsModes
+, userModes
 ;%0A%09%0A%09pri
@@ -849,16 +849,42 @@
 ice (v))
+, as documented in RFC1459
 %0A%09%09userP
@@ -1023,220 +1023,504 @@
 %09%0A%09%09
-this.channelListModes = new ArrayList%3CString%3E();%0A%09%09this.channelSetArgsModes = new ArrayList%3CString%3E();%0A%09%09this.channelSetUnsetArgsModes = new ArrayList%3CString%3E();%0A%09%09this.channelNoArgsModes = new ArrayList%3CString%3E(
+//Initialize channel modes with the default set documented in RFC1459%0A%09%09this.channelListModes = StringUtils.parseStringtoList(%22b%22, %22,%22);%0A%09%09this.channelSetArgsModes = StringUtils.parseStringtoList(%22l%22, %22,%22);%0A%09%09this.channelSetUnsetArgsModes = StringUtils.parseStringtoList(%22k%22, %22,%22);%0A%09%09this.channelNoArgsModes = StringUtils.parseStringtoList(%22p,s,i,t,n,m%22, %22,%22);%0A%09%09%0A%09%09//Initialize user modes with the default set documented in RFC1459%0A%09%09this.userModes = StringUtils.parseStringtoList(%22i,s,w,o%22, %22,%22
 );%0A%09
@@ -2632,32 +2632,32 @@
 oArgsModes()%0A%09%7B%0A
-
 %09%09return channel
@@ -2667,24 +2667,88 @@
 rgsModes;%0A%09%7D
+%0A%09%0A%09public List%3CString%3E getUserModes()%0A%09%7B%0A%09%09return userModes;%0A%09%7D
 %0A%0A%09public St

Initialize all modes in ServerInfo with their documented defaultd (#43)