register("pb", getPastebin, "Display the contents of the last SUCS PasteBin URL to be mentioned.");

pastboardURL = "http://sucs.org/Tools/PasteBin/";
function getPastebin()
{
	//Get the pasteboard contents
	var snippet = urlget(lastURL);
	snippet = snippet.split("\n");
	for(var i=0; i<snippet.length ; i++)
	{
		wrap(lastURLuser, 
			colourUser(lastURLuser,
				repeatChar(" ", userWidth - (""+i).length - 2) + i + ": "), 
			snippet[i]);
	}
}

function pastebin(user, text)
{
	//Find the URL:
	var pb = text.substr(text.search(pastboardURL));
	print(pb);
	pb = pb.split(" ")[0];
	lastURL = pb+"/plain";
	lastURLuser = user;
	return text;
}
addTrigger("*", pastboardURL, pastebin);

