Compare with Previous | Blame | View Log
-- PlazesJaiku 0.1, November 20, 2006 -- Allows you to set your Adium (http://adium.sourceforge.net/) status message to your current Jaiku (http://www.jaiku.com/) presence message. -- Note that this is a primitive hack, and will break when and if the format of the Jaiku badge changes. -- (c) 2006 by Reinvented Inc. (www.reinvented.net) -- Licensed under the GNU Public License -- http://www.fsf.org/licensing/licenses/gpl.txt -- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -- You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- Set this to the URL of your Jaiku "badge" -- the complete one that has "js-large" in the URL -- Obviously you want to change this default value, or you'll have MY presence information in your Adium! set JaikuBadge to "http://jaiku.com/badge/js-large/ruk" -- And away we go... -- First, use cURL to grab the Jaiku badge text -- this is a snippet of JavaScript that we'll parse the presence out of. set myPresence to do shell script "/usr/bin/curl " & JaikuBadge -- The actual Jaiku presence message appears after the only <br/> returned in the badge, and ends with </div></div></div></div></a>, so we parse it out. set presenceBegins to offset of "<br/>" in myPresence set presenceBegins to presenceBegins + 5 set presenceEnds to offset of "</div></div></div></div></a>" in myPresence set presenceEnds to presenceEnds - 1 set presenceOutput to text presenceBegins through presenceEnds of myPresence -- Set the status message in Adium tell application "Adium" set my status message to presenceOutput end tell