Changeset 3fa365348354abaae683febb59beaa605b0ffab2
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rf0556c4
|
r3fa3653
|
|
| 56 | 56 | void on_chat(); |
| 57 | 57 | |
| | 58 | obby::local_buffer* m_buffer; |
| | 59 | |
| 58 | 60 | signal_chat_type m_signal_chat; |
| 59 | 61 | |
-
|
rf0556c4
|
r3fa3653
|
|
| 23 | 23 | |
| 24 | 24 | Gobby::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) |
| 26 | 27 | { |
| 27 | 28 | m_btn_chat.set_label(_("Send")); |
| … |
… |
|
| 61 | 62 | void Gobby::Chat::obby_start(obby::local_buffer& buf) |
| 62 | 63 | { |
| | 64 | m_buffer = &buf; |
| | 65 | |
| 63 | 66 | m_log_chat.clear(); |
| 64 | 67 | m_ent_chat.set_sensitive(true); |
| … |
… |
|
| 70 | 73 | void Gobby::Chat::obby_end() |
| 71 | 74 | { |
| | 75 | m_buffer = NULL; |
| | 76 | |
| 72 | 77 | m_ent_chat.clear_history(); |
| 73 | 78 | m_ent_chat.set_sensitive(false); |
| … |
… |
|
| 111 | 116 | void Gobby::Chat::add_line(obby::user& user, const Glib::ustring& message) |
| 112 | 117 | { |
| 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); |
| 114 | 129 | } |
| 115 | 130 | |