void ChatPanel::Parted( User& who, const wxString& message ) { // assert( m_type == CPT_Channel || m_type == CPT_Server || m_type == CPT_Battle || m_type == CPT_User ); bool me_parted = m_channel && &who == &m_channel->GetMe(); if ( m_type == CPT_Channel ) { if ( m_channel == 0 ) return; if ( me_parted ) { m_channel->uidata.panel = 0; SetChannel( 0 ); return; } if ( sett().GetDisplayJoinLeave( m_channel->GetName() ) ) { // change the image of the tab to show new events SetIconHighlight( highlight_join_leave ); OutputLine( _T( " ** " ) + who.GetNick() + _( " left the " ) + GetChatTypeStr() + _T( "( " ) + message + _T( " )." ), sett().GetChatColorJoinPart(), sett().GetChatFont() ); } } else if ( m_type == CPT_Battle ) { if ( sett().GetDisplayJoinLeave( _T( "game/battle" ) ) ) { OutputLine( _T( " ** " ) + who.GetNick() + _( " left the " ) + GetChatTypeStr() + _T( "( " ) + message + _T( " )." ), sett().GetChatColorJoinPart(), sett().GetChatFont() ); } } else if ( m_type == CPT_Server && me_parted ) return; if ( m_show_nick_list && ( m_nicklist != 0 ) ) { unsigned int numusers = 0; if ( m_type == CPT_Channel ) numusers = GetChannel()->GetNumUsers(); else if ( m_type == CPT_Server && m_server ) numusers = m_server->GetNumUsers(); m_usercount_label->SetLabel( wxString::Format( _("%d users"), numusers ) ); m_nicklist->RemoveUser( who ); } // Also remove the User from the TextCompletionDatabase textcompletiondatabase.Delete_Mapping( who.GetNick() ); }
void ChatPanel::Parted(User& who, const wxString& message) { // assert( m_type == CPT_Channel || m_type == CPT_Server || m_type == CPT_Battle || m_type == CPT_User ); const bool me_parted = m_channel && &who == &m_channel->GetMe(); const wxString nick = TowxString(who.GetNick()); const bool wasactive = m_active_users.erase(nick) > 0; if (m_display_joinitem || (wasactive && !who.IsBot())) { OutputLine(_T( "** " ) + wxString::Format(_("%s left %s (%s)."), nick.c_str(), GetChatTypeStr().c_str(), message.c_str()), sett().GetChatColorJoinPart()); } if (m_type == CPT_Channel) { if (m_channel == 0) return; if (me_parted) { m_channel->panel = nullptr; SetChannel(0); return; } if (m_display_joinitem) { // change the image of the tab to show new events SetIconHighlight(highlight_join_leave); } } else if (m_type == CPT_Server && me_parted) return; if (m_show_nick_list && (m_nicklist != nullptr)) { m_nicklist->RemoveUser(who); UpdateUserCountLabel(); } // Also remove the User from the TextCompletionDatabase textcompletiondatabase.Delete_Mapping(TowxString(who.GetNick())); }
void ChatPanel::Joined( User& who ) { if ( m_type == CPT_Channel ) { if ( sett().GetDisplayJoinLeave( m_channel->GetName() ) ) { // change the image of the tab to show new events SetIconHighlight( highlight_join_leave ); OutputLine( _T( " ** " ) + who.GetNick() + _( " joined the " ) + GetChatTypeStr() + _T( "." ), sett().GetChatColorJoinPart(), sett().GetChatFont() ); } } else if ( m_type == CPT_Battle ) { if ( sett().GetDisplayJoinLeave( _T( "game/battle" ) ) ) { OutputLine( _T( " ** " ) + who.GetNick() + _( " joined the " ) + GetChatTypeStr() + _T( "." ), sett().GetChatColorJoinPart(), sett().GetChatFont() ); } } if ( m_show_nick_list && ( m_nicklist != 0 ) ) { unsigned int numusers = 0; if ( m_type == CPT_Channel ) numusers = GetChannel()->GetNumUsers(); else if ( m_type == CPT_Server && m_server ) numusers = m_server->GetNumUsers(); m_usercount_label->SetLabel( wxString::Format( _("%d users"), numusers ) ); m_nicklist->AddUser( who ); } // Also add the User to the TextCompletionDatabase textcompletiondatabase.Insert_Mapping( who.GetNick(), who.GetNick() ); }
void ChatPanel::OnChannelJoin(User& who) { // assert( m_type == CPT_Channel || m_type == CPT_Server || m_type == CPT_Battle || m_type == CPT_User ); if (m_show_nick_list && (m_nicklist != nullptr)) { m_nicklist->AddUser(who); UpdateUserCountLabel(); } if (m_display_joinitem) { OutputLine(_T( "** " ) + wxString::Format(_("%s joined %s."), TowxString(who.GetNick()).c_str(), GetChatTypeStr().c_str()), sett().GetChatColorJoinPart()); } // Also add the User to the TextCompletionDatabase textcompletiondatabase.Insert_Mapping(TowxString(who.GetNick()), TowxString(who.GetNick())); }
void ChatPanel::Joined(User& who) { if (m_display_joinitem) { // change the image of the tab to show new events if (m_type == CPT_Channel) { SetIconHighlight(highlight_join_leave); } OutputLine(_T( "** " ) + wxString::Format(_("%s joined %s."), TowxString(who.GetNick()).c_str(), GetChatTypeStr().c_str()), sett().GetChatColorJoinPart()); } if (m_show_nick_list && (m_nicklist != nullptr)) { m_nicklist->AddUser(who); UpdateUserCountLabel(); } // Also add the User to the TextCompletionDatabase textcompletiondatabase.Insert_Mapping(TowxString(who.GetNick()), TowxString(who.GetNick())); }