All pastes #563169 Raw Edit

Mine

public text v1 · immutable
·published 2007-06-13 01:01 UTC
rendered paste body
using terms from application "Colloquy"
	on process user command theCommand with theArguments for theView
		if theCommand is "gone" or "away" then
			tell theView to send message "<strong>is away: </strong>" & theArguments to theView with action tense
			do shell script "defaults write com.Colloquy.awayscript 'awaym' '" & theArguments & "'"
			do shell script "defaults write com.Colloquy.awayscript 'awayt' '" & (current date) & "'"
		end if
		
		if theCommand is "back" then
			if (do shell script "defaults read com.Colloquy.awayscript 'awayt'") is "" then
				add event message "You were not away"
			end if
			
			if (do shell script "defaults read com.Colloquy.awayscript 'awayt'") is not "" then
				set timestamp to (current date) - date (do shell script "defaults read com.Colloquy.awayscript 'awaym'")
				set gonetime to "Gone " & timestamp div hours & " hours, " & timestamp div minutes & " minutes, " & timestamp - (timestamp div minutes * 60) & " seconds."
				tell theView to send message "<strong>is back: </strong>" & gonetime with action tense
				do shell script "defaults write com.Colloquy.awayscript 'awaym' ''"
			end if
		end if
	end process user command
end using terms from