OSDN Git Service

- shogi_server/command.rb: Commands specific to 81Dojo, startig with '%%%', are just...
[shogi-server/shogi-server.git] / shogi_server / command.rb
index daf501f..f604ea9 100644 (file)
@@ -96,6 +96,10 @@ module ShogiServer
         cmd = GetBuoyCountCommand.new(str, player, game_name)
       when /^\s*$/
         cmd = SpaceCommand.new(str, player)
+      when /^%%%[^%]/
+        # TODO: just ignore commands specific to 81Dojo.
+        # Need to discuss with 81Dojo people.
+        cmd = VoidCommand.new(str, player)
       else
         cmd = ErrorCommand.new(str, player)
       end
@@ -112,6 +116,18 @@ module ShogiServer
     attr_accessor :time
   end
 
+  # Dummy command which does nothing.
+  #
+  class VoidCommand < Command
+    def initialize(str, player)
+      super
+    end
+
+    def call
+      return :continue
+    end
+  end
+
   # Application-level protocol for Keep-Alive.
   # If the server receives an LF, it sends back an LF.  Note that the 30 sec
   # rule (client may not send LF again within 30 sec) is not implemented