lib/cinch/plugins/hangouts/subscription.rb in cinch-hangouts-1.0.5 vs lib/cinch/plugins/hangouts/subscription.rb in cinch-hangouts-1.0.6
- old
+ new
@@ -15,11 +15,11 @@
subs.save
end
def delete
subs = Subscription.storage
- subs.data[nick] = nil
+ subs.data.delete(nick)
subs.save
end
def self.for_user(nick)
return nil unless list.key?(nick)
@@ -28,19 +28,28 @@
def self.list
storage.data
end
- def self.notify(hangout_id, bot)
+ def self.notify(hangout_id, bot, type)
nick = Hangout.find_by_id(hangout_id).nick
list.each_value do |s|
# Don't link the person who linked it.
unless nick == s.nick
user = Cinch::User.new(s.nick, bot)
message = "#{nick} just linked a new hangout at: " +
Hangout.url(hangout_id)
- Hangout.respond(user, message)
+ respond(user, message, type)
end
+ end
+ end
+
+ def self.respond(user, message, type)
+ case type
+ when :notice
+ user.notice message
+ when :pm
+ user.send message
end
end
private