I would like to monitor the status of one or my buddies in Messages.app.
So far I have been using IMService
without any problems by registering for IMPersonStatusChangedNotification
notifications from the IMService's notification center.
But this class is deprecated in Mavericks AND [IMService notificationCenter]
returns nil
.
I thought of two unsatisfying alternatives:
Polling every few seconds using Messages' AppleScript interface, but that seems contrary to the energy saving spirit of Mavericks. I'd rather receive notifications. The only purpose of this app is to monitor a buddy's status so it really shouldn't be a energy hog!
Use Messages' AppleScript event handlers
on buddy became available
andon buddy became unavailable
to notify my app (via AppleScript) that a buddy's status changed, but this requires to manually add the AppleScript in Messages' preferences. This would interfere with any custom AppleScript the user is already using in Messages. Plus it's not clear to me how the idle status is handled.
Is there a way to receive a notification when a buddy's status changes in Mavericks? If not, what would be the best way to monitor a buddy's status?
The particular service is GoogleTalk in case this makes thinks easier.
Edit: The best solution might be to build a very very light XMPP client so as not to rely at all on Messages.app or the system. Any guidance on how to do that?