using GLib;

public   delegate void cbCommand();

public struct ServerCallbackData
{
	public int replyID;
	public cbCommand cbc;
	ServerCallbackData( int id,  cbCommand _cbc) 
	{ replyID=id; cbc = _cbc; }
}

public class ServerCommands : Object {
	ServerCallbackData[] commands;
	string parameter;
	construct {    	commands=new ServerCallbackData[]
									{
											new ServerCallbackData(1 , on_default),
											new ServerCallbackData(2, on_user)
										};
	}
	
	 void on_default()
	{
			stdout.printf("on_default()\n");
	}
	
   void on_user()
	{
			stdout.printf("on_user()\n");
		
	}
	
	void deleg(int id)
	{
		 
		for (int i=0;i<commands.length;i++) {
			if (commands[i].replyID == id) 
					commands[i].cbc();
		}
	}
	
	static void main(string []args)
	{
		 var t=new ServerCommands();
		  t.deleg(1);	
			t.deleg(2);	
	}
}

