shokai/skype-ruby

usefull chat wrapper

Closed this issue · 3 comments

wrapper

chat = Skype.chats.find{|c| c.members.include? "shokaishokai" }
chat.post "hello"
chat.messages.each do |m|
  puts m
end

methods

get recent_chats

Skype.search("recentchats").scan(/(#[^\s,]+)[\s,]/).map{|i| i[0] }

get messages in chat

exec("GET CHAT #{chat_id} RECENTCHATMESSAGES").
  split(/,* /).
  reject{|i|
  i !~ /^\d+$/
}.map{|i|
  i.to_i
}.sort.reverse

gem a message

{
  :user => Skype.exec("GET CHATMESSAGE #{id} from_handle").split(/ /).last,
  :body => Skype.exec("GET CHATMESSAGE #{id} body").gsub(/^MESSAGE \d+ BODY /i,''),
  :time =>  = Time.at Skype.exec("GET CHATMESSAGE #{id} timestamp").split(/ /).last.to_i
}

cacheしたい

Chat#membersがほしい

released with v0.1.0