Skip to content

Instantly share code, notes, and snippets.

@mizchi
Created January 23, 2013 08:40
Show Gist options
  • Save mizchi/4603205 to your computer and use it in GitHub Desktop.
Save mizchi/4603205 to your computer and use it in GitHub Desktop.
#! /usr/bin/env ruby
require "rubygems"
require "rb-skypemac"
require "readline"
include SkypeMac
def get_channels
res = Skype.send_(:command => "SEARCH RECENTCHATS")
res.sub! "CHATS ", ""
channels = res.split(", ")
return channels
end
def get_message_ids (channel)
res = Skype.send_(:command => "GET CHAT #{channel} RECENTCHATMESSAGES")
res.sub! "CHAT #{channel}", ''
res.scan(/\d+/).map {|i| i.to_i}
end
def get_message(id)
res = Skype.send_(:command => "GET CHATMESSAGE #{id} BODY")
end
done = {}
for channel in get_channels
for id in get_message_ids(channel)
unless done[id]
p get_message(id)
done[id] = true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment