Tuesday, July 31, 2007

Send

You can now send messages to other people using applescript. Here's a remarkably useful script:

tell app "Adium"
if not exists chats whose contacts contain contact "applmak" then
make new chat with contacts {contact "applmak"} with new chat window
end
tell first chat whose contacts contain contact "applmak"
send message "Hi, Matt!"
end
end

Sunday, July 29, 2007

Effective chat contents

A common request for Adium's AS support is to add a way to get at the contents of a chat. Adium doesn't actually keep track of this. So, it turns out to be a hard problem.

The trick turns out to be reading from the chat logs. But this can be rather slow, as a chat may be very long. So, boredzo is writing an NSEnumerator subclass for me that will parse the logs. That way, I can effeciently traverse them, without taking too much time. That means that 'get message 342 of chat 1' will take longer than 'get message 1 of chat 1', but that's what will need to happen, I guess.