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 ) ); } } }
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 ); } } }
ChatPanel* MainChatTab::GetUserChatPanel( const wxString& user ) { for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ ) { ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i ); if ( tmp->GetPanelType() == CPT_User ) { wxString name = m_chat_tabs->GetPageText( i ); if ( name.Lower() == user.Lower() ) return ( ChatPanel* )m_chat_tabs->GetPage( i ); } } return 0; }
void MainChatTab::UpdateNicklistHighlights() { 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->UpdateNicklistHighlights(); } } if ( m_server_chat != 0 ) { m_server_chat->UpdateNicklistHighlights(); } }
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; }
ChatPanel* MainChatTab::AddChatPanel( Server& server, const wxString& name ) { for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ ) { //if ( m_chat_tabs->GetPageText( i ) == name ) { if ( true ) { // wipe all old server tabs ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i ); if ( tmp->GetPanelType() == CPT_Server ) { m_chat_tabs->DeletePage( i ); i--; } } } ChatPanel* chat = new ChatPanel( m_chat_tabs, server, m_imagelist ); m_server_chat = chat; m_chat_tabs->InsertPage( m_chat_tabs->GetPageCount() - 1, chat, name, true, wxBitmap( server_xpm ) ); return chat; }
ChatPanel* MainChatTab::AddChatPanel( Channel& channel, bool doFocus ) { for ( unsigned int i = 0; i < m_chat_tabs->GetPageCount(); i++ ) { if ( m_chat_tabs->GetPageText( i ) == channel.GetName() ) { ChatPanel* tmp = ( ChatPanel* )m_chat_tabs->GetPage( i ); if ( tmp->GetPanelType() == CPT_Channel ) { if ( doFocus ) m_chat_tabs->SetSelection( i ); tmp->SetChannel( &channel ); return tmp; } } } ChatPanel* chat = new ChatPanel( m_chat_tabs, channel, m_imagelist ); m_chat_tabs->InsertPage( m_chat_tabs->GetPageCount() - 1, chat, channel.GetName(), doFocus, wxBitmap( channel_xpm ) ); if ( doFocus ) chat->FocusInputBox(); return chat; }