Sha256: 4a9b2d120a9529eb6d4d5d4e5b8b771d649ee2353b619072f8adad752e2949f1

Contents?: true

Size: 724 Bytes

Versions: 1

Compression:

Stored size: 724 Bytes

Contents

#!/usr/bin/env ruby
require 'rubygems'
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
require 'skype'

chats = Skype.chats
puts "#{chats.length} chats found"
chats.each_with_index do |c, index|
  title = "#{c.topic} #{c.members[0..5].join(',')} (#{c.members.size} users)".strip
  puts "[#{index}] #{title}"
end

chat = nil
loop do
  print "select [0]~[#{chats.size-1}] >"
  line = STDIN.gets.strip
  next unless line =~ /^\d+$/
  chat = chats[line.to_i]
  break
end

Thread.new do
  last_id = 0
  loop do
    chat.messages.each do |m|
      next unless last_id < m.id
      puts m
      last_id = m.id
    end
    sleep 1
  end
end

loop do
  line = STDIN.gets.strip
  next if line.empty?
  chat.post line
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skype-0.1.5 bin/skype-chat