package heufybot.modules;

import java.util.List;

public class Part extends Module
{
	public Part()
	{
		this.authType = Module.AuthType.Anyone;
		this.trigger = "^" + commandPrefix + "(part)($| .*)";
	}
	
	@Override
	public void processEvent(String source, String message, String triggerUser, List<String> params) 
	{
		if (params.size() == 1)
		{
			bot.getIRC().cmdPART(source, "");
		}
		else
		{
			if(params.size() > 2)
			{
				bot.getIRC().cmdPART(params.get(1), params.get(2));
			}
			else
			{
				bot.getIRC().cmdPART(params.get(1), "");
			}
		}
	}

	public String getHelp(String message)
	{
		return "Commands: " + commandPrefix + "part (<channel> <message>) | Makes the bot part the current channel or a given one.";
	}

	@Override
	public void onLoad() 
	{
	}

	@Override
	public void onUnload()
	{
	}
}

@@ -20,16 +20,52 @@
 dules;%0A%0A
+import heufybot.utils.StringUtils;%0A%0A
 import j
@@ -431,16 +431,37 @@
 lse%0A%09%09%7B%0A
+%09%09%09params.remove(0);%0A
 %09%09%09if(pa
@@ -474,17 +474,17 @@
 ize() %3E 
-2
+1
 )%0A%09%09%09%7B%0A%09
@@ -490,56 +490,105 @@
 %09%09%09%09
-bot.getIRC().cmdPART(params.get(1), params.get(2
+String channel = params.remove(0);%0A%09%09%09%09bot.getIRC().cmdPART(channel, StringUtils.join(params, %22 %22
 ));%0A
@@ -641,17 +641,17 @@
 ams.get(
-1
+0
 ), %22%22);%0A

Fix Part message parsing (fixes #49)