Created
January 23, 2013 08:40
-
-
Save mizchi/4603205 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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