Menu

Quitmessage

Help
2003-01-19
2003-03-06
  • Nobody/Anonymous

    I'm doing $irc->quit('Quit...');
    But it just quit without saying anything: BotNick has quit IRC (Client closed connection)
    v. 0.5.0, running under webserver

     
    • Mirco Bauer

      Mirco Bauer - 2003-01-19

      hhhm that could be a little bug... first upgrade to 0.5.1 for using the current version, then search in SmartIRC.php for "function quit" in there should be a line like this:
      $this->disconnect(true);
      change it to:
      $this->disconnect(false);

      and tell me if that helps...

       
    • Nobody/Anonymous

      Now it says: BotNick has quit IRC (Quit: BotNick)
      v.0.5.1

       
    • Mirco Bauer

      Mirco Bauer - 2003-01-20

      pk now paste the debug output, but sure to enable debugging with $irc->setDebug(SMARTIRC_DEBUG_ALL);
      1-2 lines before the QUIT and 1-2 lines are the QUIT is enough...

       
    • Nobody/Anonymous

      Here is this debug messages:

      Jan 21 17:42:25 DEBUG_IRCMESSAGES: received: ":Odik!~no@213.59.246.88 PRIVMSG #Kozanostra :!exit"
      Jan 21 17:42:25 DEBUG_MESSAGEHANDLER: calling internal method "net_smartirc_messagehandler->_privmsg" (by string)
      Jan 21 17:42:25 DEBUG_ACTIONHANDLER: actionhandler match found for id: 0 type: 2 message: "!exit" regex: "^!exit$"
      Jan 21 17:42:25 DEBUG_ACTIONHANDLER: calling method "gamebot->quit"
      Jan 21 17:42:25 DEBUG_IRCMESSAGES: sent: "QUIT"
      Jan 21 17:42:26 DEBUG_CONNECTION: disconnected

       
    • Mirco Bauer

      Mirco Bauer - 2003-01-21

      show me how you registered that !exit actionhandler...

       
    • Nobody/Anonymous

      $irc->registerActionhandler(SMARTIRC_TYPE_CHANNEL, "^!exit$", &$bot, "quit");

       
      • Mirco Bauer

        Mirco Bauer - 2003-01-21

        now paste your gamebot::quit() method...
        or at least the $irc->quit() call...

         
    • Nobody/Anonymous

      Here it is:

      function quit(&$irc) {
          $irc->quit('Quit...');
      }

       
    • Nobody/Anonymous

      So what to do with quit message?

       
      • Mirco Bauer

        Mirco Bauer - 2003-01-22

        search again in SmartIRC.php for "function quit"
        comment the $this->discconec() completly out, and try again (quitting)...

         
    • Anonymous

      Anonymous - 2003-03-06

      Commenting it out got it working
      Also, noticed a possible error in the code:
      f ($quitmessage !== null) {

      shouldnt that be

      f ($quitmessage != null) {

      Im not sure, havent ever seen !== used before, but that doesnt mean it cant.

       
      • Mirco Bauer

        Mirco Bauer - 2003-03-06

        the === and !== are special operators that exists in PHP, because you can't control variable types. PHP does all type casts by itself which can be pain....
        if (0 == NULL) this is TRUE
        if (1 == NULL) this is FALSE
        if ("foo" == 1) this is TRUE
        if ("foo" == 0) this is FALSE
        if ("foo" == TRUE) this is TRUE
        if ("foo" == FALSE) this is FALSE
        if (TRUE == 1) this is TRUE
        if (FALSE == 1) this is FALSE

        here can you see what the type casts feature does, it can be very useful or a real problem :)
        with the === it also compares the _variable type_ and the value
        so it will look like this:
        if (0 === NULL) this is FALSE
        if (1 === NULL) this is FALSE
        if ("foo" === 1) this is FALSE
        if ("foo" === 0) this is FALSE
        if ("foo" === TRUE) this is FALSE
        if ("foo" === FALSE) this is FALSE
        if (TRUE === 1) this is FALSE
        if (FALSE === 1) this is FALSE

        the types are:
        1 is integer
        NULL is null
        "foor" is string
        TRUE/FALSE is boolean

        the default value for $quitmessage is NULL,
        if you pass quitmessage(0); because you want 0 as quitmessage   and SmartIRC wouldn't use === then the quitmessage would not be used. This is because 0 == null would be TRUE, to avoid these default value problem and type casts, I always use === for default value checking...

         

Log in to post a comment.