cinch-hangouts 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,7 +51,7 @@ module Cinch::Plugins
51
51
  else
52
52
  Hangout.new(m.user.nick, hangout_id, Time.now)
53
53
  .save
54
- Subscription.notify(hangout_id, @bot)
54
+ Subscription.notify(hangout_id, @bot, @response_type)
55
55
  end
56
56
  end
57
57
 
@@ -94,14 +94,5 @@ module Cinch::Plugins
94
94
  " it was last linked #{hangout.time.ago.to_words}"
95
95
  end
96
96
  end
97
-
98
- def respond(user, message)
99
- case @response_type
100
- when :notice
101
- user.notice message
102
- when :pm
103
- user.send message
104
- end
105
- end
106
97
  end
107
98
  end
@@ -17,7 +17,7 @@ class Subscription < Cinch::Plugins::Hangouts
17
17
 
18
18
  def delete
19
19
  subs = Subscription.storage
20
- subs.data[nick] = nil
20
+ subs.data.delete(nick)
21
21
  subs.save
22
22
  end
23
23
 
@@ -30,7 +30,7 @@ class Subscription < Cinch::Plugins::Hangouts
30
30
  storage.data
31
31
  end
32
32
 
33
- def self.notify(hangout_id, bot)
33
+ def self.notify(hangout_id, bot, type)
34
34
  nick = Hangout.find_by_id(hangout_id).nick
35
35
  list.each_value do |s|
36
36
  # Don't link the person who linked it.
@@ -38,11 +38,20 @@ class Subscription < Cinch::Plugins::Hangouts
38
38
  user = Cinch::User.new(s.nick, bot)
39
39
  message = "#{nick} just linked a new hangout at: " +
40
40
  Hangout.url(hangout_id)
41
- Hangout.respond(user, message)
41
+ respond(user, message, type)
42
42
  end
43
43
  end
44
44
  end
45
45
 
46
+ def self.respond(user, message, type)
47
+ case type
48
+ when :notice
49
+ user.notice message
50
+ when :pm
51
+ user.send message
52
+ end
53
+ end
54
+
46
55
  private
47
56
 
48
57
  def self.storage
@@ -3,7 +3,7 @@ module Cinch
3
3
  module Plugins
4
4
  # Versioning Info
5
5
  class Hangouts
6
- VERSION = '1.0.5'
6
+ VERSION = '1.0.6'
7
7
  end
8
8
  end
9
9
  end
@@ -102,7 +102,7 @@ describe Cinch::Plugins::Hangouts do
102
102
 
103
103
  it 'should allow users to unsubscribe' do
104
104
  get_replies(make_message(@bot, '!hangouts subscribe'))
105
- msg = make_message(@bot, '!hangouts unsubscribe')
105
+ get_replies(make_message(@bot, '!hangouts unsubscribe'))
106
106
  Cinch::Plugins::Hangouts::Subscription.list.length
107
107
  .should == 0
108
108
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cinch-hangouts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-20 00:00:00.000000000 Z
12
+ date: 2014-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake