]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/message.rb
message: force Irc color to be specificed with 2 digits
[user/henk/code/ruby/rbot.git] / lib / rbot / message.rb
index aa825e135ba31585348c2825d6fa19e94f4d1538..918425d9ea65b41730646d22224a2da541d51cf2 100644 (file)
@@ -70,7 +70,7 @@ module Irc
 
   # Convert a String or Symbol into a color number
   def Irc.find_color(data)
-    if Integer === data
+    "%02d" % if Integer === data
       data
     else
       f = if String === data
@@ -91,10 +91,10 @@ module Irc
   def Irc.color(fg=nil,bg=nil)
     str = Color.dup
     if fg
-     str << Irc.find_color(fg).to_s
+     str << Irc.find_color(fg)
     end
     if bg
-      str << "," << Irc.find_color(bg).to_s
+      str << "," << Irc.find_color(bg)
     end
     return str
   end
@@ -128,6 +128,10 @@ module Irc
     # has the message been replied to/handled by a plugin?
     attr_accessor :replied
 
+    # should the message be ignored?
+    attr_accessor :ignored
+    alias :ignored? :ignored
+
     # instantiate a new Message
     # bot::      associated bot class
     # server::   Server where the message took place
@@ -145,6 +149,7 @@ module Irc
       @message = BasicUserMessage.stripcolour message
       @replied = false
       @server = server
+      @ignored = false
 
       @identified = false
       if @msg_wants_id && @server.capabilities[:"identify-msg"]