Menu

How2 rejoin channels after reconnect

Help
Def Jeff
2007-02-13
2013-04-09
  • Def Jeff

    Def Jeff - 2007-02-13

    Hi there,

    I'm testing my Bot with WinXp and PHP 5 an it works great.
    But I've got one Problem.
    I've got a dynamic IP and after the ping timeout, the bot reconnects, but doesn't rejoin the channels it was into before the ping timeout.

    It doesn't run the row $irc->join( array('chan1','chan2') ); again
    after the reconnection but a whois on the bot's nick is successful.

    Am I missing something or is this just strange behavior on the bot-side? :D
    And if so, how do I solve this problem?

     
    • Mirco Bauer

      Mirco Bauer - 2007-02-13

      If you look at reconnect():
      http://cvs.php.net/viewvc.cgi/pear/Net_SmartIRC/SmartIRC.php?revision=1.90&view=markup
      you will see that it rejoins them if channel sync is activated

       
    • Def Jeff

      Def Jeff - 2007-02-13

      Aah...OK, thank you :)

      So, I use this like that?:

          $bot = &new jBot( );
          $irc = &new Net_SmartIRC( );
          $irc->setUseSockets( TRUE );
          $irc->setAutoRetry(TRUE);
          $irc->setAutoReconnect (TRUE);
          $irc->setTransmitTimeout(180);
          $irc->setReceiveTimeout(180);
          $irc->setChannelSyncing(TRUE);
         
          $irc->setDebug(SMARTIRC_DEBUG_ALL);

          $irc->connect( $host, $port );
          $irc->login( $nickname, $realname, 0, $ident );
          $irc->message(SMARTIRC_TYPE_QUERY,$authservice,"AUTH $authname $authpassword");
          $irc->join( array('chan1','chan2') );
          $irc->listen( );
          $irc->reconnect( );

      Is this the right way to do that?

      Anyway,
      thanks for your help :)

       
      • Mirco Bauer

        Mirco Bauer - 2007-02-14

        The $irc->reconnect() is not needed after listen(), as the lib will do that alone because you use setAutoReconnect(TRUE). Should rejoin the channels after the connection was lost and reconnected.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.