Ejemplo n.º 1
0
void EventLogManager::RemoveOldItems( void )
{
  BOOL RemoveOldItems = FALSE;
  int MaxAgeMins;
  int MaxItems;

  RemoveOldItems = BOOLPREF(PREF_bRemoveOldEventLogItems);
  MaxAgeMins = INTPREF(PREF_nMaxEventLogAgeMins);
  MaxItems = INTPREF(PREF_nMaxEventLogItems);

  if (!RemoveOldItems)
    return;

  // FIFO
  while (m_EventLog.GetSize() > MaxItems)
  {
    RemoveItem(m_EventLog[0]);
  }

  time_t now;
  time(&now);
  EventLogItem *pELI;

  for (int i = 0 ; i < m_EventLog.GetSize(); i ++)
  {
    pELI = m_EventLog[i];

    if ((difftime(now,pELI->m_Time) / 60) >= MaxAgeMins)
    {
      RemoveItem(pELI);
    }
  }
}
Ejemplo n.º 2
0
CLogger::CLogger(void)
{
  m_LogFile.SetBufferSize(INTPREF(PREF_nLogBufferSize));
  m_UpdateFrequency = INTPREF(PREF_nLogFlushInterval); // flush every X seconds
  m_Flags = LOGF_NONE;
  m_FilterList = NULL; // don't filter anything by default
  m_SecondsSinceLastFlush = 0;
  m_LogFolder = NULL;
  m_LogFileName = NULL;
  m_LogFormatStr = NULL;
  CListener::Start(&g_EventManager);
}
Ejemplo n.º 3
0
void CLogger::UpdateSettings(DWORD Flags)
{
  Stop();

  m_UpdateFrequency = INTPREF(PREF_nLogFlushInterval); // flush every X seconds
  m_Flags = Flags;

  m_LogFile.SetBufferSize(INTPREF(PREF_nLogBufferSize));

  if (m_Flags & LOGF_ENABLED)
    Start();
}
Ejemplo n.º 4
0
void COutputView::UpdateSettings( void )
{
  if (g_pPrefs)
  {
    m_MsgView.SetMaxBufferLines(INTPREF(PREF_nMaxScrollBufferLines));
    m_MsgView.SetTimeStamps(BOOLPREF(PREF_bOutputWindowTimestamps));
    m_MsgView.SetFont(FONTPREF(PREF_fOutputWindowFont));
    m_MsgView.SetColors(g_pPrefs->m_ColorPrefs);

    if (BOOLPREF(PREF_bSocketLogging))
      m_MsgView.SetFilterList(NULL);
    else
      m_MsgView.SetFilterList(g_DefaultFilterList_Output);
  }
  m_MsgView.RedrawWindow();
}
Ejemplo n.º 5
0
void CServerMonitorView::UpdateSettings( void )
{
  if (IsDocking())
  {
  	DWORD dwStyle = GetWindowLong(GWL_EXSTYLE) & (~(WS_EX_APPWINDOW | WS_EX_TOPMOST)); // remove the flags..
    SetWindowLong( GWL_EXSTYLE , dwStyle);
  }
  // m_MsgView.SetFilterList(g_DefaultFilterList_ServerMonitor); // TODO: we don't do this anymore, BUT we will need to add m_Filter to CServerMonitorView instead
  if (g_pPrefs)
  {
    m_MsgView.SetTimeStamps(BOOLPREF(PREF_bServerMonitorTimestamps));
    m_MsgView.SetMaxBufferLines(INTPREF(PREF_nMaxScrollBufferLines));
    m_MsgView.SetFont(FONTPREF(PREF_fServerMonitorFont));
    m_MsgView.SetColors(g_pPrefs->m_ColorPrefs);
  }
  m_MsgView.RedrawWindow();
}
Ejemplo n.º 6
0
void TextQueueManager::RemoveOldItems( void )
{
  BOOL RemoveOldItems = FALSE;
  int MaxAgeMins;
  int MaxItems;
  switch(m_QueueType)
  {
    case CWQUEUE_PRIVMSG:
      RemoveOldItems = BOOLPREF(PREF_bRemoveOldPrivmsgLogItems);
      MaxAgeMins = INTPREF(PREF_nMaxPrivMsgLogAgeMins);
      MaxItems = INTPREF(PREF_nMaxPrivMsgLogItems);
      break;
    case CWQUEUE_NOTICE:
      RemoveOldItems = BOOLPREF(PREF_bRemoveOldNoticeLogItems);
      MaxAgeMins = INTPREF(PREF_nMaxNoticeLogAgeMins);
      MaxItems = INTPREF(PREF_nMaxNoticeLogItems);
      break;      
    case CWQUEUE_URLCATCHER:
      RemoveOldItems = BOOLPREF(PREF_bRemoveOldURLCatcherItems);
      MaxAgeMins = INTPREF(PREF_nMaxURLCatcherAgeMins);
      MaxItems = INTPREF(PREF_nMaxURLCatcherItems);
      break;
  }

  if (!RemoveOldItems)
    return;

  // FIFO
  while (m_TextQueue.GetSize() > MaxItems)
  {
    RemoveItem(m_TextQueue[0]);
  }

  time_t now;
  time(&now);
  TextQueueItem *pTQI;

  for (int i = 0 ; i < m_TextQueue.GetSize(); i ++)
  {
    pTQI = m_TextQueue[i];

    if ((difftime(now,pTQI->m_Time) / 60) >= MaxAgeMins)
    {
      RemoveItem(pTQI);
    }
  }
}