Changeset 3fa365348354abaae683febb59beaa605b0ffab2

Show
Ignore:
Timestamp:
01/06/07 23:40:21 (6 years ago)
Author:
Philipp Kern <phil@…>
Parents:
f0556c487a7ab1dfde8967f3f7f9a0a045ee0e82
Children:
325e0646468ad29991478f77cb45f2c3b99c88b9
git-committer:
Philipp Kern <phil@0x539.de> / 2007-01-06T22:40:21Z+0000
Message:

[project @ Highlight chat messages with the own nickname [fixes #6]]

Original author: Philipp Kern <phil@…>
Date: 2005-06-30 19:36:36+00:00

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • inc/chat.hpp

    rf0556c4 r3fa3653  
    5656        void on_chat(); 
    5757 
     58        obby::local_buffer* m_buffer; 
     59 
    5860        signal_chat_type m_signal_chat; 
    5961 
  • src/chat.cpp

    rf0556c4 r3fa3653  
    2323 
    2424Gobby::Chat::Chat() 
    25  : Gtk::VBox(), m_img_btn(Gtk::Stock::JUMP_TO, Gtk::ICON_SIZE_BUTTON) 
     25 : Gtk::VBox(), m_buffer(NULL), 
     26   m_img_btn(Gtk::Stock::JUMP_TO, Gtk::ICON_SIZE_BUTTON) 
    2627{ 
    2728        m_btn_chat.set_label(_("Send")); 
     
    6162void Gobby::Chat::obby_start(obby::local_buffer& buf) 
    6263{ 
     64        m_buffer = &buf; 
     65 
    6366        m_log_chat.clear(); 
    6467        m_ent_chat.set_sensitive(true); 
     
    7073void Gobby::Chat::obby_end() 
    7174{ 
     75        m_buffer = NULL; 
     76 
    7277        m_ent_chat.clear_history(); 
    7378        m_ent_chat.set_sensitive(false); 
     
    111116void Gobby::Chat::add_line(obby::user& user, const Glib::ustring& message) 
    112117{ 
    113         m_log_chat.log("<" + user.get_name() + "> " + message, "black"); 
     118        obby::user self = m_buffer->get_self(); 
     119        Glib::ustring colour; 
     120        // Highlight the message if the user's nickname is found in it, 
     121        // but not if the message is coming from the user itself. 
     122        if( (user != self) && 
     123            (message.find(self.get_name() ) != Glib::ustring::npos) ) 
     124                colour = "darkred"; 
     125        else 
     126                colour = "black"; 
     127 
     128        m_log_chat.log("<" + user.get_name() + "> " + message, colour); 
    114129} 
    115130