All pastes #917358 Raw Edit

Unnamed

public text v1 · immutable
#917358 ·published 2008-02-25 09:33 UTC
rendered paste body
		# COOKIE
		elsif msg =~ /^cookie(settings)?\ (https?:\/\/)?([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?/ then		
			url = msg.split("\ ", 2)[1].to_s
			if url.split(//)[url.length - 1] != "/" then
				url += "/"
				added = true
			end

			#m = /(?:.*?\/\/)?(www\.)?(.*?)(\/[^\.]*\/)+/.match(url)
			m = /(?:.*?\/\/)?(www\.)?([^\/]+)(\/[^\.]*\/)+/.match(url)
			if m[2] !~ /^localhost$/ then
				domain = "." + m[2]
			else
				domain = "The \"Cookie Domain\" field should be left blank"
			end
			path = m[3]
			while added == true && path =~ /\/\/$/ do
				path = path.gsub(/\/\/$/, "/")
			end
			place("PRIVMSG #{chan} :Cookie Domain\: #{domain}")
			place("PRIVMSG #{chan} :Cookie Path\: #{path}")