After routine testing, I've discovered that many ofl the Applescript callback handlers mentioned in the scripting dictionary do not get called.
The only ones I can get working are:
load
unload
kicked from room
idle
build contextual menu for item
handle clicked contextual menu item
I haven't tested the ctcp handlers yet ('process subcode request' and 'process subcode reply'), but ALL the others fail silently.
This is a fairly serious bug for anyone wanting to script Colloquy with AppleScript?.
Here's a test suite:
property loadedScriptName : ""
using terms from application "Colloquy"
(*****************Load/Unload Handlers*****************)
on load from scriptPath
set scriptAlias to (POSIX file scriptPath) as alias
set loadedScriptName to (name of (info for scriptAlias))
set msg to (loadedScriptName & " Loaded") as string
set evt to (loadedScriptName & "loaded") as string
tell active panel of front window
add event message msg with name evt
end tell
end load
on unload
set msg to (loadedScriptName & " Unloaded") as string
set evt to (loadedScriptName & "unloaded") as string
tell active panel of front window
add event message msg with name evt
end tell
set loadedScriptName to ""
end unload
(*****************Contextual Menu Handlers*****************)
on build contextual menu for item whichItems in whichPanel
return {"test one", "test two", "test three"}
end build contextual menu for item
on handle clicked contextual menu item whichMenuItem for whichItems within whichMenuList
if (whichMenuItem as string) begins with "test" then
tell active panel of front window
add event message "contextual menu test" with name "test123..."
end tell
end if
end handle clicked contextual menu item
on handle clicked link whichURL in whichPanel
if whichURL is "http://www.testing123.com" then
tell active panel of front window
add event message "handle clicked link" with name "test123..."
end tell
return true
end if
return false
end handle clicked link
(*****************Message Handlers*****************)
on process user command whichCommand with whichArguments for whichPanel
if whichCommand is "!test123" then
display dialog "ok" default answer whichArguments
return true
end if
return false
end process user command
on process incoming chat message whatMessage from whichUser in whichPanel
if whatMessage is "test123" then
tell active panel of front window
add event message "processing incoming chat message" with name "test123..."
end tell
end if
end process incoming chat message
on process outgoing chat message whatMessage in whichPanel
if whatMessage is "test123" then
tell active panel of front window
add event message "processing outgoing chat message" with name "test123..."
end tell
end if
end process outgoing chat message
(*****************CTCP Handlers*****************)
on process subcode request whichRequest with whichArguments from whichUser on whichConnection
return false
end process subcode request
on process subcode reply with whichArguments from whichUser on whichConnection
return false
end process subcode reply
(***************** Handlers for Connecting and Disconnecting *****************)
on connected whichConnection
display dialog "connected to " & (whichConnection's id)
end connected
on disconnecting whichConnection
display dialog "disconnecting from " & (whichConnection's id)
end disconnecting
(***************** Handlers for Joining, Leaving and Kicking *****************)
on join chat room whichPanel
tell active panel of front window
add event message ("joining" & whichPanel's id) with name "test123..."
end tell
end join chat room
on parting chat room whichPanel
tell active panel of front window
add event message ("parting" & whichPanel's id) with name "test123..."
end tell
end parting chat room
on kicked from room whichPanel by whichUser for whatReason
tell active panel of front window
add event message ("you were kicked from" & whichPanel's id) with name "test123..."
end tell
end kicked from room
on member joined whichMember in whichPanel
tell active panel of front window
add event message (whichMember's id & "joined" & whichPanel's id) with name "test123..."
end tell
end member joined
on member parted whichMember from whichPanel for whatReason
tell active panel of front window
add event message (whichMember's id & "parted from" & whichPanel's id) with name "test123..."
end tell
end member parted
on member kicked whichMember from whichPanel by whichOp for whatReason
tell active panel of front window
add event message ((whichMember's id) & "was kicked from" & (whichPanel's id) & " by " & (whichOp's id)) with name "test123..."
end tell
end member kicked
(***************** Other Handlers *****************)
on topic changed in whichPanel by whichUser to newTopic
tell active panel of front window
add event message (whichUser's id & "changed the topic of " & (whichPanel's id)) with name "test123..."
end tell
end topic changed
on perform notification whichNotification with whichNotificationInfo and whichPreferences
--
end perform notification
on idle
tell active panel of front window
--add event message ("idle") with name "test123..."
end tell
return 10.0
end idle
end using terms from
Click here to open the script in script editor