Logo Search packages:      
Sourcecode: sbnc version File versions  Download package

void CUser::ScheduleReconnect ( int  Delay = 10  ) 

ScheduleReconnect

Schedules a connect attempt.

Parameters:
Delay the delay

Definition at line 721 of file User.cpp.

References GetClientConnectionMultiplexer(), CCore::GetInterval(), GetServer(), IsAdmin(), m_IRC, m_LastReconnect, m_ReconnectTime, and CClientConnection::Privmsg().

Referenced by Attach(), CUser(), CIRCConnection::ParseLineArgV(), CClientConnection::ProcessBncCommand(), Reconnect(), and SetServer().

                                       {
      int MaxDelay, Interval;

      if (m_IRC != NULL) {
            return;
      }

      CacheSetInteger(m_ConfigCache, quitted, 0);

      MaxDelay = Delay;
      Interval = g_Bouncer->GetInterval();

      if (Interval == 0) {
            Interval = 15;
      }

      if (g_CurrentTime - g_LastReconnect < Interval && MaxDelay < Interval) {
            MaxDelay = Interval;
      }

      if (g_CurrentTime - m_LastReconnect < 120 && MaxDelay < 120 && !IsAdmin()) {
            MaxDelay = 120;
      }

      if (m_ReconnectTime < g_CurrentTime + MaxDelay) {
            m_ReconnectTime = g_CurrentTime + MaxDelay;

            RescheduleReconnectTimer();
      }

      if (GetServer() != NULL && GetClientConnectionMultiplexer() != NULL) {
            char *Out;
            asprintf(&Out, "Scheduled reconnect in %d seconds.", m_ReconnectTime - g_CurrentTime);

            CHECK_ALLOC_RESULT(Out, asprintf) {} else {
                  GetClientConnectionMultiplexer()->Privmsg(Out);

                  free(Out);
            } CHECK_ALLOC_RESULT_END;
      }
}


Generated by  Doxygen 1.6.0   Back to index