Adium - Current chat contact display name

I’m trying to get the display name (not the account name) of a person who just messaged me in Adium. I’m planning to use this as a AdiumExtra, where the name is simply returned. In an away message, it would be like this:

Not like this:

Help would be appreciated.

EDIT: I got this:


global currentContact
on substitute()
	tell application "Adium"
		try
			set currentContact to chat name of the active chat of the first interface controller
		on error
			set currentContact to "person"
		end try
	end tell
	return currentContact
end substitute

But then it sometimes returns the wrong name when there are multiple chats open. According to the AduimExtras, the code needs to be in a “substiute()” method to work.

Hi ThreeDee912, did you get this to work?