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
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.º 3
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);
    }
  }
}
Ejemplo n.º 4
0
void IRCQuery::UpdateLogger( void )
{
  DWORD LoggingFlags = LOGF_NONE;
  char *Folder;

  if (BOOLPREF(PREF_bCreateNetworkLogFolder))
  {    
    Folder = HydraIRC_BuildString(MAX_PATH,"%s\\%s",PATHPREF(PREF_pLogRootFolder),GetNetworkName(m_pServer->m_pDetails->m_NetworkID));
  }
  else
  {
    Folder = strdup(PATHPREF(PREF_pLogRootFolder));
  }
  m_Logger.SetPaths(Folder,HydraIRC_BuildString(MAX_PATH,"Query_%s.txt",m_OtherNick));

  if (BOOLPREF(PREF_bLogging) && BOOLPREF(PREF_bQueryLogging)) LoggingFlags |= LOGF_ENABLED;
  if (BOOLPREF(PREF_bStripCodesFromQueryLogs)) LoggingFlags |= LOGF_STRIPCODES;

  // update the settings and start logging!
  m_Logger.UpdateSettings(LoggingFlags);
}
Ejemplo n.º 5
0
void CServerListView::UpdateSettings( void )
{
  if (g_pPrefs)
  {
    m_tree.SetBkColor(COLORVAL(item_serverlistbackground));
    m_tree.SetTextColor(COLORVAL(item_serverlistnormaltext));
    m_tree.SetFont(GetAppFont(PREF_fServerListFont));

    if (m_pToolTip)
      m_pToolTip.Activate(BOOLPREF(PREF_bServerListToolTips));
  }
  m_tree.RedrawWindow();
}
Ejemplo n.º 6
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.º 7
0
void CChildCommon::HideWindow( void )
{
  if (BOOLPREF(PREF_bHideNotMinimize))
  {
    BOOL FoundNonHiddenWindow = FALSE;
    int i;
    for (i = 0 ; i < g_ChildWndList.GetSize(); i++)
    {
      HWND hWnd = g_ChildWndList[i]->m_hWnd;

      
      if (hWnd == m_hWnd)
        continue; // ignore ourself

      DWORD dwStyle = ::GetWindowLong(hWnd,GWL_STYLE);

      if (dwStyle & WS_VISIBLE)
      {
        FoundNonHiddenWindow = TRUE;
        break;
      }
    }
    //SetWindowPos(NULL,0,0,0,0,SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER);
    if (FoundNonHiddenWindow)
      g_pMainWnd->MDINext(m_hWnd);

    ShowWindow(SW_HIDE);

#ifdef USE_TABBEDMDI
    //SetTabText("HIDDEN");
	// TODO: FIX THIS
    ::SendMessage(GetParent(), UWM_MDICHILDHIDDEN, (WPARAM)m_hWnd, 0);
#endif
  }
  else
  {
    ShowWindow(SW_MINIMIZE);
  }
}
Ejemplo n.º 8
0
// TODO: add this functionality to the item's context menu.
LRESULT CTransfersView::OnNmDblClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/)
{
  LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) pnmh;

  if (lpnmitem->iItem != -1)
  {
    CDCCTransfer *pDCCTransfer;
    pDCCTransfer = (CDCCTransfer *) m_TransfersListCtrl.GetItemData(lpnmitem->iItem);

    if (pDCCTransfer)      
    {
      if (pDCCTransfer->m_Type == DCC_RECEIVE)
      {
        if (pDCCTransfer->m_Status == DCCT_STATUS_COMPLETE)
        {
          // Completed Transfer

          // When a user double clicks the file, open the file, or the directory it's in
          if (BOOLPREF(PREF_bDCCReceiveDoubleClickOpensFile))
          {
            ShellExecute(NULL,"open",pDCCTransfer->m_LocalFileName,NULL,NULL,SW_SHOWNORMAL);
          }
          else // open the directory.
          {
            OpenDirectoryForFile(pDCCTransfer->m_LocalFileName);
          }
        }
        else
        {
          // Incomplete Transfer, open the directory
          OpenDirectoryForFile(pDCCTransfer->m_LocalFileName);
        }
      }
      // don't do anything for sends.
    }
  }

  return 0;
}
Ejemplo n.º 9
0
void IRCQuery::Initialise( void )
{
  SetDirtyFilterList(g_DefaultFilterList_DirtyStatusQuery);

  m_QueryID = g_IDManager.ObtainID();

  m_ObjectType        = OTYPE_QUERY;
  m_Status            = QRY_STATE_INITIALISING;
  m_pChildWnd         = NULL;
  m_DescriptionString = NULL;
#ifdef DEBUG
  sys_Printf(BIC_INFO,"Created new IRCQuery instance: \"%s\"\n",m_OtherNick);
#endif

  // add to the server list window
  g_pMainWnd->m_ServerListView.Add(this);

  if (!BOOLPREF(PREF_bCreateQueryWindowsHidden))
  {
    ShowQueryWindow();
  }
  else
  {
    SetDirtyStatus(DIRTY_RECENT | DIRTY_TRUE);
  }

  char *message = HydraIRC_BuildString(128,"New Query from %s",m_OtherNick);
  
  if (message)
  {
    g_pMainWnd->SetStatusBar(STATUS_ICON_INFORMATION,message);
    free(message);
  }

  UpdateLogger();
  
  OnConnect();
}
Ejemplo n.º 10
0
void CServerListView::AddItem(int ItemType, void *pItemData)
{
  STIInfo STII(ItemType,pItemData);

  if (ItemType == STI_SERVER)
  {
    // Server's go in the root of the tree...
    TreeItemInfo *pNewTII = new TreeItemInfo(STII.m_TIIItem,STII.m_ItemData,0,STII_NONE);
    m_TIIList.Add(pNewTII);
    HTREEITEM hItem=m_tree.InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM,
      STII.m_ItemName,
      STII.m_iconindices[2],STII.m_iconindices[3], // image & selected image numbers
      0,0, // unused
      (LPARAM)pNewTII, //pServer,
      TVI_ROOT,TVI_SORT);
  }
  else
  {
    TVITEM item;
    HTREEITEM hServerItem;
    HTREEITEM hGroupItem;
    HTREEITEM hItem;
    HTREEITEM hNewLocation;
    item.pszText = NULL;
    item.iImage = 0;
    item.iSelectedImage = 0;
    item.state = 0;
    item.stateMask = 0;
    item.lParam = 0;  
    TreeItemInfo *pTII;

    switch (ItemType)
    {
      case STI_DCCCHAT:
        hServerItem = FindItem(STI_SERVER,(void *)STII.m_pServer->m_pOtherServer);
        break;
      case STI_QUERY:
        hServerItem = FindItem(STI_SERVER,(void *)STII.m_pQuery->m_pServer);
        break;
      case STI_CHANNEL:
        hServerItem = FindItem(STI_SERVER,(void *)STII.m_pChannel->m_pServer);
        break;
    }

    if (hServerItem)
    {
      item.mask = TVIF_CHILDREN;
      item.hItem = hServerItem; // we want more info about this tree node.
      if (m_tree.GetItem(&item))
      {
        // when we find the right place to put the item, we set it here.
        // when searching 
        hNewLocation = NULL;

        if (item.cChildren > 0)
        {
          // find the DCCChats/Channels/Queries child window group tree item
          if (hGroupItem = m_tree.GetChildItem(hServerItem))
          {
            do
            {
              item.mask = TVIF_PARAM;
              item.hItem = hGroupItem; // we want more info about this tree node.
              if (m_tree.GetItem(&item))
              {
                pTII = (TreeItemInfo *)item.lParam;
                if (pTII->m_Type == STII.m_TIIGroup)
                {
                  // found the channels tree view item under the server.
                  hNewLocation = hGroupItem;
                  break;
                }
              }
              hGroupItem = m_tree.GetNextSiblingItem(hGroupItem);
            } while (hGroupItem);
          }
        }

        if (hNewLocation == NULL)
        {
          // TODO: Add a pref for this
          if (!BOOLPREF(PREF_bServerListChannelGroups) && ItemType == STI_CHANNEL)
          {
            // add channels directly under the server node.
            hNewLocation = hServerItem;
          }
          else
          {
            // if there are no other windows of this kind open
            // So we add a group for them to appear under.

            // TODO: Insert groups alphabetcially (or in a proper defined order ?)
            TreeItemInfo *pNewTII = new TreeItemInfo(STII.m_TIIGroup,NULL,STII.m_TreeSortValue,STII_NONE);
            m_TIIList.Add(pNewTII);
            hNewLocation=m_tree.InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM,
              STII.m_GroupName,
              STII.m_iconindices[0],STII.m_iconindices[1], // image & selected image numbers
              0,0, // unused
              (LPARAM)pNewTII,
              hServerItem,hServerItem);
          }
        }

        if (hNewLocation != NULL)
        {
          TreeItemInfo *pNewTII = new TreeItemInfo(STII.m_TIIItem, STII.m_ItemData,0,STII_NONE);
          m_TIIList.Add(pNewTII);
          hItem=m_tree.InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM,
            STII.m_ItemName,
            STII.m_iconindices[2],STII.m_iconindices[3], // image & selected image numbers
            0,0, // unused
            (LPARAM)pNewTII,
            hNewLocation,TVI_SORT);
          m_tree.Expand(hServerItem); // expand the server
          m_tree.Expand(hNewLocation); // expand the group
          //m_tree.SelectItem(hItem);

        }
#ifdef DEBUG
        else 
        {
          ATLASSERT(0); // unable to find the right place to put the icon
        }
#endif
      }
    }
  }
}