Exemplo n.º 1
0
void IRCQuery::UpdateInfo( void )
{
  if (!m_pChildWnd || !m_pChildWnd->IsWindow() || !CHILDFRAMEPTR(m_pChildWnd)->m_InfoView.IsWindow() )
    return;

  CString Message;

  switch(m_Status)
  {
    case QRY_STATE_CONNECTED:
      Message.Format("Chatting to %s",m_OtherNick);
      break;
    case QRY_STATE_DISCONNECTED:
      Message.Format("Disconnected!");
      break;
  }

  struct tm *then;
  then = localtime( &m_LastActivityTime );
  char *TimeStamp = GetTimestamp(then);
  Message.AppendFormat("\nLast activity at %s",TimeStamp);

  
  CHILDFRAMEPTR(m_pChildWnd)->m_InfoView.Put(Message);
}
Exemplo n.º 2
0
void IRCQuery::UpdateStatus( void )
{
  BuildDescriptionString();  
  if (m_pChildWnd)
  {
    CHILDFRAMEPTR(m_pChildWnd)->UpdateStatus();
    CHILDFRAMEPTR(m_pChildWnd)->m_HeaderView.UpdateHeader(m_DescriptionString);    
    UpdateInfo();
  }

  ::PostMessage(m_pServer->m_pChildWnd->m_hWnd,WM_UPDATEINFOPANE, (WPARAM)0, (LPARAM)NULL);
  g_pMainWnd->m_ServerListView.Update(this);
}
Exemplo n.º 3
0
void IRCCommon::ClearUserList( void )
{
  m_Users.DeleteAll();
  if (m_pChildWnd)
  {
    CHILDFRAMEPTR(m_pChildWnd)->m_UserListView.RemoveAll();
  }

  // if the global user list is pointing at this window, then clear it.
  // because we just free()'d the users!
  if (g_pMainWnd->m_UserListView.m_pChannel == this)
  {
    g_pMainWnd->ClearGlobalUserList();
  }
}
Exemplo n.º 4
0
void CServerListView::DoAction( int Action )
{
  if (!IsValidTreeItem(m_SelectedTreeItem))
    return;

  switch (m_SelectedTreeItem->m_Type)
  {
    case TII_IRCSERVER:
      {
        IRCServer *pServer = (IRCServer *)m_SelectedTreeItem->m_Data;
        switch( Action )
        {
          case SLMI_Connect:
            pServer->Connect();
            break;
          case SLMI_Disconnect:
            pServer->Disconnect(FALSE);
            break;
          case SLMI_Reconnect:
            pServer->Disconnect(FALSE);
            pServer->Reconnect();
            break;
          case SLMI_Close:
            if (::IsWindow(pServer->m_pChildWnd->m_hWnd))
            CHILDFRAMEPTR(pServer->m_pChildWnd)->PostMessage(WM_CLOSE);
            break;
          case SLMI_Logging:
            g_pMainWnd->ToggleLogging(CHILDFRAMEPTR(pServer->m_pChildWnd));
            break;
          case SLMI_Monitoring:
            g_pMainWnd->ToggleMonitoring(CHILDFRAMEPTR(pServer->m_pChildWnd));
          case SLMI_ListChannels:
            pServer->ShowChannelListDialog();           
            break;
        }
      }
      break;
    case TII_IRCCHANNEL:
      {
        IRCChannel *pChannel = (IRCChannel *)m_SelectedTreeItem->m_Data;
        switch( Action )
        {
          case SLMI_Close:
            if (::IsWindow(pChannel->m_pChildWnd->m_hWnd))
            CHILDFRAMEPTR(pChannel->m_pChildWnd)->PostMessage(WM_CLOSE);
            break;
          case SLMI_Logging:
            g_pMainWnd->ToggleLogging(CHILDFRAMEPTR(pChannel->m_pChildWnd));
            break;
          case SLMI_Monitoring:
            g_pMainWnd->ToggleMonitoring(CHILDFRAMEPTR(pChannel->m_pChildWnd));
            break;
          case SLMI_Properties:
            pChannel->DoPropertiesDlg();
            break;
          case SLMI_Cycle:
            pChannel->Cycle();
            break;
        }
      }
      break;
    case TII_DCCCHAT:
      {
        IRCServer *pServer = (IRCServer *)m_SelectedTreeItem->m_Data;
        switch( Action )
        {
          case SLMI_Close:
            if (::IsWindow(pServer->m_pChildWnd->m_hWnd))
            CHILDFRAMEPTR(pServer->m_pChildWnd)->PostMessage(WM_CLOSE);
            break;
          case SLMI_Logging:
            g_pMainWnd->ToggleLogging(CHILDFRAMEPTR(pServer->m_pChildWnd));
            break;
        }
      }
      break;

    case TII_QUERY:
      {
        IRCQuery *pQuery = (IRCQuery *)m_SelectedTreeItem->m_Data;
        switch( Action )
        {
          case SLMI_Close:
            if (pQuery->m_pChildWnd)
            {
              if (::IsWindow(pQuery->m_pChildWnd->m_hWnd))
              CHILDFRAMEPTR(pQuery->m_pChildWnd)->PostMessage(WM_CLOSE);
            }
            else
              delete pQuery;

            break;
          case SLMI_Logging:
            g_pMainWnd->ToggleLogging(CHILDFRAMEPTR(pQuery->m_pChildWnd));
            break;
        }
      }
      break;
  }
  m_SelectedTreeItem = NULL;
}
Exemplo n.º 5
0
void IRCCommon::ProcessOutputBuffer( void )
{
#ifdef VERBOSE_DEBUG
  sys_printf(BIC_FUNCTION,"IRCCommon::ProcessOutputBuffer()\n");
#endif
  // process the buffer if we have text in it
  // but keep the buffer for later if the window's not open yet.

  if (m_pChildWnd)
  {
    CChildFrame *pChildFrame = CHILDFRAMEPTR(m_pChildWnd);
    
    switch (m_ObjectType)
    {
      case OTYPE_QUERY:
      case OTYPE_CHANNEL:
      case OTYPE_SERVER:
      case OTYPE_DCCCHAT:

        // there are several ways of handling this:
        // 1) process 1 line for 1 message.
        //    NOTE: this kinda works, but because we can add lines to
        //    the buffer before the window exists we can end up with
        //    lines in the buffer that don't get processed immediately.
        // 2) process entire buffer when we get a message
        //    (we'll get several messages that we don't do anything with though..)
        //    NOTE: This works fine, except that user input is delayed while we process
        //    the buffer, which can take a while if we have alot to process.
        // 3) process some of the buffer when we get a message
        //    and post another message if there's some left.
        // 4) process 1 line for 1 message
        //    post another message if there's some left.

        //
        // Tried method 2, see notes, tried 1, see notes, going with 4..

        // Method 4
        // Process, a single line of the buffer
        // Then send another message if any remaining buffer

        // sometimes we have already processed the buffer
        // by the time we process the message.
        // as ProcessBuffer() is also called just after creation.
        if (!(m_OutputBuffer.GetSize() > 0))
          break;

        BufferItem *pBI = m_OutputBuffer[0];

        pChildFrame->m_MsgView.Put(pBI->m_Contents, pBI->m_Buffer,&pBI->m_Time);    

        // Slap it over to the channel monitor too..
        if (m_ObjectType == CWTYPE_CHANNEL)
        {
          if (g_pMainWnd->m_ChannelMonitorView.IsMonitoring(pChildFrame->m_pChannel))
          {
            g_pMainWnd->m_ChannelMonitorView.Put(pChildFrame->m_pChannel,pBI);
          }
        }

        // Slap it over to the server monitor too..
        if (m_ObjectType == CWTYPE_SERVER)
        {
          if (g_pMainWnd->m_ServerMonitorView.IsMonitoring(pChildFrame->m_pServer))
          {
            g_pMainWnd->m_ServerMonitorView.Put(pChildFrame->m_pServer,pBI);
          }
        }

        m_OutputBuffer.RemoveAt(0);
        delete pBI;

        // more waiting ?
        if (m_OutputBuffer.GetSize() > 0)
        {
          m_pChildWnd->PostMessage(WM_BUFFERWAITING,0,0);
        } 

        // Method 2
        /*
        while (m_OutputBuffer.GetSize() > 0)
        {
          // Process, display and then free each buffer
          BufferItem *pBI = m_OutputBuffer[0];

          pChildFrame->m_MsgView.Put(pBI->m_Contents, pBI->m_Buffer);    

          // Slap it over to the channel monitor too..
          if (m_ObjectType == CWTYPE_CHANNEL)
          {
            if (g_pMainWnd->m_ChannelMonitorView.IsMonitoring(pChildFrame->m_pChannel))
            {
              g_pMainWnd->m_ChannelMonitorView.Put(pChildFrame->m_pChannel,pBI);
            }
          }

          m_OutputBuffer.RemoveAt(0);
          delete pBI;
        }
        */
        break;
    }
  }
#ifdef VERBOSE_DEBUG
  sys_printf(BIC_FUNCTION,"Exiting IRCCommon::ProcessOutputBuffer()\n");
#endif
}