@Override
	public void onPrivmsg(String connectionName, String host, Message m) {
		if(m.getContent().toLowerCase().contains("$"+connection.getNick())) {
			String mess = m.getContent();
			System.out.println("mess:"+mess);
			if(mess.toLowerCase().contains(":")) {
				mess = mess.substring(mess.indexOf(" ")+1, mess.length());
				
				String ambushNick = mess.substring(0,mess.indexOf(":")).trim();
				System.out.println("ambushNick:"+ambushNick);

				mess = mess.substring(mess.indexOf(":"), mess.length()).trim();

				String ambushMess = mess;
				System.out.println("ambush message:"+ambushMess.trim());

				nicksWithAmbush.add(ambushNick);
				ambushMessages.add("<"+m.getNickname()+"> "+mess);
				connection.send("PRIVMSG "+m.getParams()[0]+" The operation succeeded.");
			} else if(mess.toLowerCase().contains("help")) {
				System.out.println(m.getParams()[0]);
				connection.send("PRIVMSG "+m.getParams()[0]+" Ambush syntax: <nick> ':' <message>");
			} else if(mess.toLowerCase().contains(" join ")){
				String joinChannel = mess.substring(mess.indexOf(" join ")+6, mess.length()).trim();
				connection.send("JOIN "+joinChannel);
			}  else if(mess.toLowerCase().contains(" part ")){
				String partChannel = mess.substring(mess.indexOf(" part ")+6, mess.length()).trim();
				connection.send("PART "+partChannel);
			}
		} else {
			int n = 0;
			while(checkAmbushNicks(m.getNickname()) >= 0){
				int index = checkAmbushNicks(m.getNickname());
				if(index >= 0) {
					if(n == 0) {
						connection.send("PRIVMSG "+m.getParams()[0]+" "+nicksWithAmbush.get(index)+
								" While you were out.");
					}
					connection.send("PRIVMSG #ecsig " +ambushMessages.get(index));
					nicksWithAmbush.remove(index);
					ambushMessages.remove(index);
					n++;
				}
			}
		}
	}