]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/irc.rb
rss plugin: watching now relies on an ID built from title, link and description to...
[user/henk/code/ruby/rbot.git] / lib / rbot / irc.rb
index c2c1e82fdd518c30889a1eed9cad0830857ea9de..398f74d16999e6fe0cbc8b5f16b162b0e1ecea74 100644 (file)
@@ -629,12 +629,19 @@ module Irc
       end\r
     end\r
 \r
-    # A Netmask is easily converted to a String for the usual representation\r
+    # A Netmask is easily converted to a String for the usual representation.\r
+    # We skip the user or host parts if they are "*", unless we've been asked\r
+    # for the full form\r
     #\r
+    def to_s\r
+      ret = nick.dup\r
+      ret << "!" << user unless user == "*"\r
+      ret << "@" << host unless host == "*"\r
+      return ret\r
+    end\r
     def fullform\r
       "#{nick}!#{user}@#{host}"\r
     end\r
-    alias :to_s :fullform\r
 \r
     # Converts the receiver into a Netmask with the given (optional)\r
     # server/casemap association. We return self unless a conversion\r
@@ -900,7 +907,7 @@ module Irc
     # Checks if a User is well-known or not by looking at the hostname and user\r
     #\r
     def known?\r
-      return nick!= "*" && user!="*" && host!="*"\r
+      return nick != "*" && user != "*" && host != "*"\r
     end\r
 \r
     # Is the user away?\r
@@ -1164,7 +1171,7 @@ module Irc
       #\r
       def initialize(text="", set_by="", set_on=Time.new)\r
         @text = text\r
-        @set_by = set_by.to_irc_user\r
+        @set_by = set_by.to_irc_netmask\r
         @set_on = set_on\r
       end\r
 \r
@@ -1456,10 +1463,10 @@ module Irc
     # Resets the Channel and User list\r
     #\r
     def reset_lists\r
-      @users.each { |u|\r
+      @users.reverse_each { |u|\r
         delete_user(u)\r
       }\r
-      @channels.each { |u|\r
+      @channels.reverse_each { |u|\r
         delete_channel(u)\r
       }\r
     end\r
@@ -1526,6 +1533,10 @@ module Irc
             groups.each { |g|\r
               k, v = g.split(':')\r
               @supports[key][k] = v.to_i || 0\r
+              if @supports[key][k] == 0\r
+                warn "Deleting #{key} limit of 0 for #{k}"\r
+                @supports[key].delete(k)\r
+              end\r
             }\r
           }\r
         when :chanmodes\r
@@ -1677,7 +1688,8 @@ module Irc
           channel_names.each { |n|\r
             count += 1 if k.include?(n[0])\r
           }\r
-          raise IndexError, "Already joined #{count} channels with prefix #{k}" if count == @supports[:chanlimit][k]\r
+          # raise IndexError, "Already joined #{count} channels with prefix #{k}" if count == @supports[:chanlimit][k]\r
+          warn "Already joined #{count}/#{@supports[:chanlimit][k]} channels with prefix #{k}, we may be going over server limits" if count >= @supports[:chanlimit][k]\r
         }\r
 \r
         # So far, everything is fine. Now create the actual Channel\r