コード例 #1
0
void MainChatTab::RejoinChannels()
{
	for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ )
	{
		ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i );
		if ( tmp->GetPanelType() == CPT_Channel )
		{

			// TODO: This will not rejoin passworded channels.
			wxString name = m_chat_tabs->GetPageText( i );
			bool alreadyin = false;
			try
			{
				serverSelector().GetServer().GetChannel( name ).GetMe();
				alreadyin = true;
			}
			catch ( ... ) {}
			if ( !alreadyin )
			{
				serverSelector().GetServer().JoinChannel( name, _T( "" ) );
				tmp->SetChannel( &serverSelector().GetServer().GetChannel( name ) );
			}

		} else if ( tmp->GetPanelType() == CPT_User )
		{

			wxString name = m_chat_tabs->GetPageText( i );
			if ( serverSelector().GetServer().UserExists( name ) ) tmp->SetUser( &serverSelector().GetServer().GetUser( name ) );

		}
	}
}
コード例 #2
0
void MainChatTab::OnUserDisconnected( User& user )
{
	ChatPanel* panel = GetUserChatPanel( user.GetNick() );
	if ( panel != 0 )
	{
		panel->OnUserDisconnected();
		panel->SetUser( 0 );
		//TODO disable send button (koshi)
	}
	if ( m_server_chat != 0 )
	{
		m_server_chat->Parted( user, _T("") );
	}
}
コード例 #3
0
void MainChatTab::OnUserConnected( User& user )
{
	ChatPanel* panel = GetUserChatPanel( user.GetNick() );
	if ( panel != 0 )
	{
		panel->SetUser( &user );
		panel->OnUserConnected();
		//TODO enable send button (koshi)
	}
	if ( m_server_chat != 0 )
	{
		m_server_chat->OnChannelJoin( user );
	}
}
コード例 #4
0
void MainChatTab::LeaveChannels()
{
	for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ ) {
		ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i );
		if ( tmp->GetPanelType() == CPT_Channel )
		{
			tmp->StatusMessage( _( "Disconnected from server, chat closed." ) );
			tmp->SetChannel( 0 );
		} else if ( tmp->GetPanelType() == CPT_User )
		{
			tmp->StatusMessage( _( "Disconnected from server, chat closed." ) );
			tmp->SetUser( 0 );
		}
	}
}
コード例 #5
0
ChatPanel* MainChatTab::AddChatPanel( const User& user )
{
	for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ ) {
		if ( m_chat_tabs->GetPageText( i ) == user.GetNick() ) {
			ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i );
			if ( tmp->GetPanelType() == CPT_User ) {
				m_chat_tabs->SetSelection( i );
				tmp->SetUser( &user );
				return tmp;
			}
		}
	}
	int selection = m_chat_tabs->GetSelection();
	ChatPanel* chat = new ChatPanel( m_chat_tabs, user, m_imagelist );
	m_chat_tabs->InsertPage( m_chat_tabs->GetPageCount() - 1, chat, user.GetNick(), true, wxBitmap( userchat_xpm ) );
	if ( selection > 0 ) m_chat_tabs->SetSelection( selection );
	return chat;
}