skype 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f55fb6515dd62ebcf14675c0baea34a9a7a7d10e
4
- data.tar.gz: ced58a4a2c91ec00dce90a431d24810312973c2c
3
+ metadata.gz: 2eced28795b2a77a42df86107d84682ef5d8380b
4
+ data.tar.gz: a451d065c2e3f5b13ae653afe33781b85bd4064a
5
5
  SHA512:
6
- metadata.gz: eeeb14ae23fb7791b40502dc73e2a41c3e18c660625410f747ef72f28547551a02bbd60993e12d1f2729febfe1c6d2493656554eb404b12dfdfda7dc449b1027
7
- data.tar.gz: b541ab42b556bfb088dc2c1cefdf32154295e37e4ef9b650a67ef790dc7d2308d5efd66e5f2399d78c7d415e888c50ab71c59357cb3cda2ff7f4d50a15fa0a12
6
+ metadata.gz: 9531c430f248eff98199bd17f948dbe95a35769dc564b029e40dba90e64514986ebfebe4132486c68549b56b6649cec9c1d763e9a32908bc8ff8872b20d46a18
7
+ data.tar.gz: 9b1a8bff9f6dcc04c07ef8ebda9257ca43654e060ee9e9e712adff4c8f98b99f3e35a18441d563acc35907079c24e57d12881114f84e1d368b70f48f65fb2907
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- skype (0.1.3)
4
+ skype (0.1.4)
5
5
  tmp_cache
6
6
 
7
7
  GEM
@@ -1,3 +1,8 @@
1
+ === 0.1.4 2013-06-30
2
+
3
+ * bugfix of chat wrapper
4
+ * update chat sample
5
+
1
6
  === 0.1.3 2013-06-30
2
7
 
3
8
  * wrap the return value of chat message with Skype::Chat::Message
data/README.md CHANGED
@@ -26,7 +26,7 @@ for Linux
26
26
  Gemfile
27
27
  ```ruby
28
28
  gem "skype"
29
- gem "ruby-dbus" if RUBY_PLATFORM =~ /linux/i
29
+ gem "ruby-dbus" if RUBY_PLATFORM =~ /linux/i
30
30
  ```
31
31
 
32
32
  Usage
@@ -1,3 +1,3 @@
1
1
  module Skype
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -16,7 +16,7 @@ module Skype
16
16
  attr_reader :id, :topic, :members
17
17
 
18
18
  def initialize(id)
19
- @id = id.to_i
19
+ @id = id
20
20
  @topic = ::Skype.exec("GET CHAT #{@id} TOPIC").scan(/TOPIC (.*)$/)[0][0].toutf8 rescue @topic = ""
21
21
  @members = ::Skype.exec("GET CHAT #{@id} MEMBERS").scan(/MEMBERS (.+)$/)[0][0].split(/\s/) rescue @members = []
22
22
  end
@@ -6,11 +6,33 @@ require 'skype'
6
6
 
7
7
  chats = Skype.chats
8
8
  puts "#{chats.length} chats found"
9
- chat = chats.find{|c| c.members.include? "shokaishokai" and c.topic =~ /test/} || chats[0]
9
+ chats.each_with_index do |c, index|
10
+ title = "#{c.topic} #{c.members[0..5].join(',')} (#{c.members.size} users)".strip
11
+ puts "[#{index}] #{title}"
12
+ end
13
+
14
+ chat = nil
15
+ loop do
16
+ print "select [0]~[#{chats.size-1}] >"
17
+ line = STDIN.gets.strip
18
+ next unless line =~ /^\d+$/
19
+ chat = chats[line.to_i]
20
+ break
21
+ end
10
22
 
11
- p chat
12
- chat.post "test"
23
+ Thread.new do
24
+ last_id = 0
25
+ loop do
26
+ chat.messages.each do |m|
27
+ next unless last_id < m.id
28
+ puts m
29
+ last_id = m.id
30
+ end
31
+ sleep 1
32
+ end
33
+ end
13
34
 
14
- chat.messages.each do |m|
15
- puts m
35
+ loop do
36
+ line = STDIN.gets.strip
37
+ chat.post line
16
38
  end
@@ -34,5 +34,6 @@ class TestSkype < MiniTest::Test
34
34
  assert_equal chat.class, Skype::Chat
35
35
  assert_equal chat.topic.class, String
36
36
  assert_equal chat.members.class, Array
37
+ assert_equal !chat.members.empty?, true
37
38
  end
38
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skype
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Hashimoto