summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-04-14 19:58:31 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-04-14 19:58:31 +0200
commit4b0cec11264b27473f9d05c0cd510166364a0fb7 (patch)
tree2c8ba1e0a23ca06cae53bce626e6dee5d777912e /data
parentb52aa00fb8fcb9ef1fe2372a72013f8ea2e1176e (diff)
uno plugin: game starter how has temporary full uno::manage permissions for the game
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/games/uno.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/data/rbot/plugins/games/uno.rb b/data/rbot/plugins/games/uno.rb
index 8fd0d087..5ae780c7 100644
--- a/data/rbot/plugins/games/uno.rb
+++ b/data/rbot/plugins/games/uno.rb
@@ -160,7 +160,10 @@ class UnoGame
# number of cards to be picked if the player can't play an appropriate card
attr_reader :picker
- def initialize(plugin, channel)
+ # the IRC user that created the game
+ attr_reader :manager
+
+ def initialize(plugin, channel, manager)
@channel = channel
@plugin = plugin
@bot = plugin.bot
@@ -178,6 +181,7 @@ class UnoGame
@picker = 0
@last_picker = 0
@must_play = nil
+ @manager = manager
end
def get_player(user)
@@ -888,10 +892,14 @@ class UnoPlugin < Plugin
def create_game(m, p)
if @games.key?(m.channel)
- m.reply _("There is already an %{uno} game running here, say 'jo' to join in") % { :uno => UnoGame::UNO }
+ m.reply _("There is already an %{uno} game running here, managed by %{who}. say 'jo' to join in") % {
+ :who => @games[m.channel].manager,
+ :uno => UnoGame::UNO
+ }
return
end
- @games[m.channel] = UnoGame.new(self, m.channel)
+ @games[m.channel] = UnoGame.new(self, m.channel, m.source)
+ @bot.auth.irc_to_botuser(m.source).set_temp_permission('uno::manage', true, m.channel)
m.reply _("Ok, created %{uno} game on %{channel}, say 'jo' to join in") % {
:uno => UnoGame::UNO,
:channel => m.channel
@@ -969,6 +977,7 @@ class UnoPlugin < Plugin
pstats[k] = pls
end
+ @bot.auth.irc_to_botuser(@games[channel].manager).reset_temp_permission('uno::manage', channel)
@games.delete(channel)
end