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::SetTopic( const wxString& who, const wxString& message ) { /* int pos = refined.Find( _T("\\n") ); // serch for the \n string while ( pos != -1 ) { if ( refined.Mid( pos - 1, 3 ) == _T("\\\n") ) continue; // the string \\n means escaped \n refined = refined.Left ( pos -1 ) + _T("\n") + refined.Right( pos +1 ); // replace the /n string with the carriage return char pos = refined.Find( _T("\\n") ); } */ wxFont f = m_chatlog_text->GetFont(); f.SetFamily( wxFONTFAMILY_MODERN ); // change the image of the tab to show new events if ( m_topic_set ) SetIconHighlight( highlight_say ); OutputLine( _( " ** Channel topic:" ), sett().GetChatColorServer(), f ); wxStringTokenizer tkz( message, _T("\n") ); while ( tkz.HasMoreTokens() ) { wxString msg = tkz.GetNextToken(); OutputLine( _T(" ") + msg, sett().GetChatColorServer(), f ); } OutputLine( _( " ** Set by " ) + who, sett().GetChatColorServer(), f ); m_topic_set = true; }
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::UnknownCommand( const wxString& command, const wxString& params ) { wxFont f = m_chatlog_text->GetFont(); f.SetFamily( wxFONTFAMILY_MODERN ); // change the image of the tab to show new events SetIconHighlight( highlight_important ); OutputLine( _( " !! Command: \"" ) + command + _( "\" params: \"" ) + params + _T( "\"." ), sett().GetChatColorError(), f ); }
//! @brief Output motd sent by server //! //! @param message The MOTD message to output void ChatPanel::Motd( const wxString& message ) { wxFont f = m_chatlog_text->GetFont(); f.SetFamily( wxFONTFAMILY_MODERN ); // change the image of the tab to show new events SetIconHighlight( highlight_say ); OutputLine( _T( " ** motd ** " ) + message, sett().GetChatColorServer(), f ); }
void ChatPanel::StatusMessage(const wxString& message) { if (m_chatlog_text == 0) { wxLogMessage(_T( "m_chatlog_text is NULL" )); } else { if (CPT_Server == m_type) SetIconHighlight(highlight_important); OutputLine(_T( "** Server ** " ) + message, sett().GetChatColorServer()); } }
void ChatPanel::StatusMessage( const wxString& message ) { if ( m_chatlog_text == 0 ) { wxLogMessage( _T( "m_chatlog_text is NULL" ) ); } else { wxFont f = m_chatlog_text->GetFont(); f.SetFamily( wxFONTFAMILY_MODERN ); if( CPT_Server == m_type ) SetIconHighlight( highlight_important ); OutputLine( _T( " ** Server ** " ) + message, sett().GetChatColorServer(), f ); } }
void ChatPanel::DidAction( const wxString& who, const wxString& action ) { // change the image of the tab to show new events SetIconHighlight( highlight_say ); OutputLine( _T( " * " ) + who + _T( " " ) + action, sett().GetChatColorAction(), sett().GetChatFont() ); if ( m_type == CPT_User && ( ui().GetActiveChatPanel() != this || !wxTheApp->IsActive() ) ) { UiEvents::GetNotificationEventSender().SendEvent( UiEvents::NotficationData( UiEvents::PrivateMessage, wxString::Format( _T("%s \n%s"), who.c_str(), action.Left(50).c_str() ) ) ); } }
//! @brief Output a message said in the channel. //! //! @param who nick of the person who said something. //! @param message the message to be outputted. void ChatPanel::Said( const wxString& who, const wxString& message ) { wxString me = GetMe().GetNick(); wxColour col; bool req_user = false; if ( who.Upper() == me.Upper() ) { col = sett().GetChatColorMine(); } else { // change the image of the tab to show new events SetIconHighlight( highlight_say ); if ( m_type == CPT_User ) req_user = true; //process logic for custom word highlights if ( ContainsWordToHighlight( message ) ) { req_user = sett().GetRequestAttOnHighlight(); col = sett().GetChatColorHighlight(); } else col = sett().GetChatColorNormal(); } if ( ( who == _T( "MelBot" ) || who == _T( "[BOT]tizbacbridgebot" ) ) && message.StartsWith( _T( "<" ) ) && message.Find( _T( ">" ) ) != wxNOT_FOUND ) { wxString who2; wxString message2; who2 = message.BeforeFirst( '>' ).AfterFirst( '<' ); if ( who != _T( "[BOT]tizbacbridgebot" ) ) who2 += _T( "@IRC" ); //don't highlight if i'm talking from irc to channel if ( who2.Upper().BeforeLast(_T('@')) == me.Upper() ) { req_user = false; col = sett().GetChatColorNormal(); } message2 = message.AfterFirst( '>' ); OutputLine( _T( " <" ) + who2 + _T( "> " ) + message2, col, sett().GetChatFont() ); } else { OutputLine( _T( " <" ) + who + _T( "> " ) + message, col, sett().GetChatFont() ); } if ( req_user ) { bool inactive = ui().GetActiveChatPanel() != this || !wxTheApp->IsActive() ; ui().mw().RequestUserAttention(); if ( inactive ) UiEvents::GetNotificationEventSender().SendEvent( UiEvents::NotficationData( UiEvents::PrivateMessage, wxString::Format( _T("%s:\n%s"), who.c_str(), message.Left(50).c_str() ) ) ); } }
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())); }
//! @brief Output a message said in the channel. //! //! @param who nick of the person who said something. //! @param message the message to be outputted. void ChatPanel::Said(const wxString& who, const wxString& message) { if (m_active_users.find(who) == m_active_users.end()) { m_active_users.insert(who); } wxString me = TowxString(GetMe().GetNick()); wxColour col; bool req_user = false; if (who.Upper() == me.Upper()) { col = sett().GetChatColorMine(); } else { // change the image of the tab to show new events SetIconHighlight(highlight_say); if (m_type == CPT_User) req_user = true; //process logic for custom word highlights if (ContainsWordToHighlight(message)) { req_user = sett().GetRequestAttOnHighlight(); col = sett().GetChatColorHighlight(); } else col = sett().GetChatColorNormal(); } if ((who == cfg().ReadString(_T("/Channel/bridgebot"))) && (message.StartsWith(_T( "<" ))) && (message.Find(_T( ">" )) != wxNOT_FOUND)) { wxString who2; wxString message2; who2 = message.BeforeFirst('>').AfterFirst('<'); message2 = message.AfterFirst('>'); OutputLine(_T( "<" ) + who2 + _T( "> " ) + message2, col); } else { OutputLine(_T( "<" ) + who + _T( "> " ) + message, col); } if (req_user) { bool inactive = ui().GetActiveChatPanel() != this || !wxTheApp->IsActive(); if (inactive) { ui().mw().RequestUserAttention(); const wxString msg = wxString::Format(_T("%s:\n%s"), who.c_str(), message.Left(50).c_str()); UiEvents::GetNotificationEventSender().SendEvent( UiEvents::NotficationData(UiEvents::PrivateMessage, msg)); } } }
/** * Process text sent by the server, not users * Check for vote events, promote events and something else */ void ChatPanel::DidAction(const wxString& who, const wxString& action) { //Handle vote events in chat by VotePanel if (m_votePanel != NULL) { m_votePanel->OnChatAction(who, action); } //Look for "promote" notifications from server CheckForPromotion(who, action); // change the image of the tab to show new events SetIconHighlight(highlight_say); OutputLine(_T( "* " ) + who + _T( " " ) + action, sett().GetChatColorAction()); if (m_type == CPT_User && (ui().GetActiveChatPanel() != this || !wxTheApp->IsActive())) { const wxString msg = wxString::Format(_T("%s \n%s"), who.c_str(), action.Left(50).c_str()); UiEvents::GetNotificationEventSender().SendEvent( UiEvents::NotficationData(UiEvents::PrivateMessage, msg)); } }
void ChatPanel::SetTopic(const wxString& who, const wxString& message) { if (message.empty()) { m_topic_set = false; return; } const wxColor col = sett().GetChatColorServer(); // change the image of the tab to show new events if (m_topic_set) SetIconHighlight(highlight_say); OutputLine(_T("** ") + _("Channel topic"), col); wxStringTokenizer tkz(message, _T("\n")); while (tkz.HasMoreTokens()) { wxString msg = tkz.GetNextToken(); OutputLine(_T(" ") + msg, col); } OutputLine(_T("** ") + wxString::Format(_("Set by %s"), who), col); m_topic_set = true; }
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::UnknownCommand(const wxString& command, const wxString& params) { // change the image of the tab to show new events SetIconHighlight(highlight_important); OutputLine(_("!! Command: \"") + command + _("\" params: \"") + params + _T( "\"." ), sett().GetChatColorError()); }
//! @brief Output motd sent by server //! //! @param message The MOTD message to output void ChatPanel::Motd(const wxString& message) { // change the image of the tab to show new events SetIconHighlight(highlight_say); OutputLine(_T( "** motd ** " ) + message, sett().GetChatColorServer()); }
void ChatPanel::OnUserConnected() { // change the image of the tab to show new events SetIconHighlight(highlight_join_leave); OutputLine(_T("** ") + _("User just got online."), sett().GetChatColorJoinPart()); }
void ChatPanel::OnUserDisconnected() { // change the image of the tab to show new events SetIconHighlight( highlight_join_leave ); OutputLine( _( " ** User is now offline." ), sett().GetChatColorJoinPart(), sett().GetChatFont() ); }