Menu

CASE sensitivity

Help
Anonymous
2003-05-03
2003-05-06
  • Anonymous

    Anonymous - 2003-05-03

    Is there anyway to make the actionHandlers case insensitive?  So $irc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, '!op*', $bot, 'op'); would catch !op, !Op, !oP, !OP ?  Or is it in the manual and I am just too blind to see it at 1am?

     
    • Mirco Bauer

      Mirco Bauer - 2003-05-03

      that is a regex, to be more accurate a preg_match() (see http://www.php.net/manual/en/function.preg-match.php\)

      There you see examples like this: "/php/i" would match PHP and php and Php, whatever... its case insensitive, but you probably noticed the slashes, there I ran into problems with SmatIRC....
      because those slashes are automaticly added by SmartIRC, so you can't put anything after the slash...
      In your case the final regex looks like: "/!op*/"

      So a fix woukd be to remove those automaticly added slashes, but then most scripts would be broken, because they are needed....
      but I could check if the given regex contains slashes, then I just use it as it is without adding anything... that would work..

      I will change that soon in the CVS version...

       
    • Nobody/Anonymous

      I am also interested about this. So I will be happy to see a fix. Where can the CVS be found for this project?

       
      • Mirco Bauer

        Mirco Bauer - 2003-05-04

        it's now in CVS, you can get the latest version from:
        http://cvs.php.net/cvs.php/pear/Net_SmartIRC

        replacing SmartIRC.php, SmartIRC/defines.php and SmartIRC/messagehandler.php is enough...

        so if you want case insensitive comparinson use this as regex for the actionhandler: /^!op/i
        that means, !op has to be at the beginning of the message (^) and the comparison is done case insensitive (/i)

        so !op !oP !OP !Op would work...

        please tell me the results...

         
        • Anonymous

          Anonymous - 2003-05-05

          With the latest SmartIRC.php from CVS it appears to be working perfectly

           
    • Mirco Bauer

      Mirco Bauer - 2003-05-06

      nice to hear that... probably 0.6.0 the next release will include it....

       

Log in to post a comment.