Changeset 4ab49e4578dd3587e295b8b27fb5b532d4a140c5
- Timestamp:
- 01/06/07 23:28:21 (6 years ago)
- Author:
- Philipp Kern <phil@…>
- Parents:
- c40b98ab109bd871aae7bc307c981541a48f88b5
- Children:
- 7d6376a1a8f3b6bbe625db18ac669845b63da897
- git-committer:
- Philipp Kern <phil@0x539.de> / 2007-01-06T22:28:21Z+0000
- Message:
-
[project @ Added handling of chat events from m_chat and m_buffer]
Original author: Benjamin Herr <ben@…>
Date: 2005-04-07 11:49:23+00:00
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rdb674f7
|
r4ab49e4
|
|
| 49 | 49 | void obby_document_insert(obby::document& document); |
| 50 | 50 | void obby_document_remove(obby::document& document); |
| | 51 | void obby_message(obby::user& user, const Glib::ustring& message); |
| | 52 | void obby_server_message(const Glib::ustring& message); |
| 51 | 53 | protected: |
| 52 | 54 | void on_chat(); |
-
|
rdb674f7
|
r4ab49e4
|
|
| 45 | 45 | void on_quit(); |
| 46 | 46 | |
| | 47 | void on_chat(const Glib::ustring& message); |
| | 48 | |
| 47 | 49 | // Obby signal handlers |
| 48 | 50 | void on_obby_login_failed(const std::string& reason); |
| … |
… |
|
| 54 | 56 | void on_obby_document_insert(obby::document& document); |
| 55 | 57 | void on_obby_document_remove(obby::document& document); |
| | 58 | |
| | 59 | void on_obby_server_chat(const Glib::ustring& message); |
| | 60 | void on_obby_chat(obby::user& user, const Glib::ustring& message); |
| 56 | 61 | |
| 57 | 62 | bool on_timer(); |
-
|
rdb674f7
|
r4ab49e4
|
|
| 91 | 91 | } |
| 92 | 92 | |
| | 93 | void Gobby::Chat::obby_message(obby::user& user, const Glib::ustring& message) |
| | 94 | { |
| | 95 | m_log_chat.log("<" + user.get_name() + "> " + message, "black"); |
| | 96 | } |
| | 97 | |
| | 98 | void Gobby::Chat::obby_server_message(const Glib::ustring& message) { |
| | 99 | m_log_chat.log(message, "forest green"); |
| | 100 | } |
| | 101 | |
| 93 | 102 | void Gobby::Chat::on_chat() |
| 94 | 103 | { |
-
|
rdb674f7
|
r4ab49e4
|
|
| 17 | 17 | */ |
| 18 | 18 | |
| | 19 | #include <stdexcept> |
| 19 | 20 | #include <gtkmm/main.h> |
| 20 | 21 | #include <gtkmm/messagedialog.h> |
| … |
… |
|
| 38 | 39 | m_header.quit_event().connect( |
| 39 | 40 | sigc::mem_fun(*this, &Window::on_quit) ); |
| | 41 | |
| | 42 | m_chat.chat_event().connect( |
| | 43 | sigc::mem_fun(*this, &Window::on_chat) ); |
| 40 | 44 | |
| 41 | 45 | m_frame_chat.set_shadow_type(Gtk::SHADOW_IN); |
| … |
… |
|
| 97 | 101 | m_buffer->remove_document_event().connect( |
| 98 | 102 | sigc::mem_fun(*this, &Window::on_obby_document_remove)); |
| | 103 | |
| | 104 | m_buffer->message_event().connect( |
| | 105 | sigc::mem_fun(*this, &Window::on_obby_chat) ); |
| | 106 | m_buffer->server_message_event().connect( |
| | 107 | sigc::mem_fun(*this, &Window::on_obby_server_chat) ); |
| | 108 | |
| 99 | 109 | |
| 100 | 110 | if(!m_timer_conn.connected() ) |
| … |
… |
|
| 226 | 236 | } |
| 227 | 237 | |
| | 238 | void Gobby::Window::on_chat(const Glib::ustring& message) { |
| | 239 | if (m_running) |
| | 240 | m_buffer->send_message(message); |
| | 241 | else |
| | 242 | throw std::runtime_error("tried to send chat message while not connected"); |
| | 243 | } |
| | 244 | |
| 228 | 245 | void Gobby::Window::on_obby_login_failed(const std::string& reason) |
| 229 | 246 | { |
| … |
… |
|
| 259 | 276 | } |
| 260 | 277 | |
| | 278 | void Gobby::Window::on_obby_chat(obby::user& user, const Glib::ustring& message) |
| | 279 | { |
| | 280 | m_chat.obby_message(user, message); |
| | 281 | } |
| | 282 | |
| | 283 | void Gobby::Window::on_obby_server_chat(const Glib::ustring& message) |
| | 284 | { |
| | 285 | m_chat.obby_server_message(message); |
| | 286 | } |
| | 287 | |
| | 288 | |
| | 289 | |
| 261 | 290 | bool Gobby::Window::on_timer() |
| 262 | 291 | { |