Colloquy demystifying JIRA references

Mon 03 August 2009

The BBC’s Forge engineering team uses an IRC channel to hold meetings. It allows our team to not bother about exactly
where everyone is - some folks work from home, people are (mostly) in the office, but can be in different parts of
our buildings for all sorts of good reasons. So, we have JIRA instead of Agile “task cards” and we use IRC meetings
instead of “standups”.

Link in any team, you’ll have some folks working on one aspect of the development, others on others. There’s an
“idealisation” in many Agile software disciplines that suggests any developer can work on any task, yet this isn’t
always so. Moreover, once someone is working on an aspect, the rest of the team are probably not going to stay on
top of all of the JIRA references - yet in IRC we often just list those JIRA numbers to speed ourselves along.

It’s not at all difficult to link to these references but it takes quite a bit of discipline - and in fairness, I’d
sooner be concentrating on what folks are saying rather than playing with URLs - hence a new plugin script for
Colloquy that helps.

This script works with a small shell script that handles regex (there is an AppleScript plugin that can do this, but
it’s not really needed for this) to identify a likely JIRA reference and to print out the title of the JIRA ticket.

As you can see it does very little - it finds strings like “FSRV-102”, or “KV-1” and prints it out, otherwise it
outputs nothing. Quite simple.

Second the AppleScript Colloquy plugin script:

propertyscriptInitialPath:nullpropertyloadedScriptName:""using terms fromapplication"Colloquy"onprocessincomingchatmessagemsginmsgChatRoomsetfrontRoomtodescriptionofactivepaneloffrontwindow-- to convert a chat room's name to a chat room's description, here's what-- I needed to do. Depending on how you connect, you may need to change-- this a little. You'll know that you do need to change this if you keep-- getting JIRA titles when your "front room" fills with unexpected JIRA-- titles! (Then again, perhaps you'd like to know what's being talked-- about and don't mind too much ...)setmsgChatRoomNameto"Chat Room #"&nameofmsgChatRoom&" (127.0.0.1)"-- check that the message we're processing is on our front panelifmsgChatRoomNameis equaltofrontRoomthentry-- the message is a class - not the text, so we have to extract itsetthisMessagetoHTMLofmsg-- I have a shell script that does the pattern matching. There is-- an extension to AppleScript that allows for this sort of work,-- but the Forge community is good with a little Unix and probably-- don't mind installing a script.-- The quotes are necessary as sentences often have spaces ...setjiraReftodo shell script"~/jiraRef.pl \""&thisMessage&"\""-- call our separate method to handle thisgetJira(jiraRef)onerror-- annoyingly, AppleScript often fails silently - and I've not-- actually seen this run.tellactivepaneloffrontwindowaddeventmessage"error caught: "&errorMessageendtellendtryendifendprocessincomingchatmessageonprocessusercommandcmdwithargsforchatRoom-- This may be useful as it allows me to check jira refsifcmdis equalto"jira"thensetjiraLinetoargssetjiraReftodo shell script"~/jiraRef.pl \""&args&"\""getJira(jiraRef)endifendprocessusercommand-- I'm sure that in the future I'll add extra parameters to this so-- that I can get things like when it was last updated, the status-- and who perhaps last commented. But for now it's simple.togetJira(jiraRef)ifjiraRefis notequal to""then-- this next ommand is long - I might write this into a seperate-- script. But again, for now it works and allows me flexibilitysetjiraTitletodo shell script\"curl --cert --pass -k https://JIRA-SERVER/browse/"&jiraRef&" \ | grep '<title>' | sed 's/title/em/g' | sed 's/ - BBC JIRA//'"tellactivepaneloffrontwindow--add event message jiraTitle with name "jiraTitle"addeventmessage"JIRA "&jiraTitle--add event message "&"\">"&jiraTitle&""withname"jiraTitle"endtellendifendgetJiraonloadfromscriptPathsetscriptAliasto(POSIXfilescriptPath)asaliassetloadedScriptNameto(nameof(info forscriptAlias))setmsgto(loadedScriptName&" Loaded /jira")as stringsetevtto(loadedScriptName&"loaded")as stringtellactivepaneloffrontwindowaddeventmessagemsgwithnameevtendtellendloadonunloadsetmsgto(loadedScriptName&" Unloaded")as stringsetevtto(loadedScriptName&"unloaded")as stringtellactivepaneloffrontwindowaddeventmessagemsgwithnameevtendtellsetloadedScriptNameto""endunloadendusing terms from

So, this script - when placed in your ~/Library/Application Support/Colloquy/PlugIns will look at incoming
messages in your front window (in a hack-tastic way), get the first of the JIRA references (if any), looks at our
JIRA-SERVER to find the title of these references. The code could do with quite a bit of tidy-up, but it works and for
the speed at which our team’s messages comes in, it’s fast enough.