Changeset 37d1c6c8b8138f6437b874300b99621b33b455a3
- Timestamp:
- 01/06/07 23:40:41 (6 years ago)
- Author:
- Philipp Kern <phil@…>
- Parents:
- 8b539409d5a028ca07bf8e7f23329ad9731d79f4
- Children:
- b09b4b0883e0286cc03cc927822c658879604fc4
- git-committer:
- Philipp Kern <phil@0x539.de> / 2007-01-06T22:40:41Z+0000
- Message:
-
[project @ User authentication stuff]
Original author: Armin Burgmeier <armin@…>
Date: 2005-07-17 13:17:52+00:00
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rf0556c4
|
r37d1c6c
|
|
| 56 | 56 | typedef sigc::signal<void> signal_document_save_type; |
| 57 | 57 | typedef sigc::signal<void> signal_document_close_type; |
| | 58 | typedef sigc::signal<void> signal_user_set_password_type; |
| 58 | 59 | typedef sigc::signal<void> signal_document_word_wrap_type; |
| 59 | 60 | #ifdef WITH_GTKSOURCEVIEW |
| … |
… |
|
| 84 | 85 | signal_document_save_type document_save_event() const; |
| 85 | 86 | signal_document_close_type document_close_event() const; |
| | 87 | signal_user_set_password_type user_set_password_event() const; |
| 86 | 88 | signal_document_word_wrap_type document_word_wrap_event() const; |
| 87 | 89 | #ifdef WITH_GTKSOURCEVIEW |
| … |
… |
|
| 108 | 110 | void on_app_document_save(); |
| 109 | 111 | void on_app_document_close(); |
| | 112 | void on_app_user_set_password(); |
| 110 | 113 | void on_app_document_word_wrap(); |
| 111 | 114 | #ifdef WITH_GTKSOURCEVIEW |
| … |
… |
|
| 150 | 153 | signal_document_save_type m_signal_document_save; |
| 151 | 154 | signal_document_close_type m_signal_document_close; |
| | 155 | signal_user_set_password_type m_signal_user_set_password; |
| 152 | 156 | signal_document_word_wrap_type m_signal_document_word_wrap; |
| 153 | 157 | #ifdef WITH_GTKSOURCEVIEW |
-
|
r8b53940
|
r37d1c6c
|
|
| 59 | 59 | void on_document_close(); |
| 60 | 60 | |
| | 61 | void on_user_set_password(); |
| | 62 | |
| 61 | 63 | void on_document_word_wrap(); |
| 62 | 64 | #ifdef WITH_GTKSOURCEVIEW |
| … |
… |
|
| 75 | 77 | void on_obby_login_failed(obby::login::error error); |
| 76 | 78 | bool on_obby_global_password(std::string& password); |
| | 79 | bool on_obby_user_password(std::string& password); |
| 77 | 80 | void on_obby_close(); |
| 78 | 81 | void on_obby_sync(); |
-
|
r3fa3653
|
r37d1c6c
|
|
| 120 | 120 | // Highlight the message if the user's nickname is found in it, |
| 121 | 121 | // but not if the message is coming from the user itself. |
| 122 | | if( (user != self) && |
| | 122 | if( (&user != &self) && |
| 123 | 123 | (message.find(self.get_name() ) != Glib::ustring::npos) ) |
| 124 | 124 | colour = "darkred"; |
-
|
rf0556c4
|
r37d1c6c
|
|
| 22 | 22 | #include <obby/format_string.hpp> |
| 23 | 23 | #include <obby/local_buffer.hpp> |
| | 24 | #include <obby/client_buffer.hpp> |
| 24 | 25 | |
| 25 | 26 | #include "features.hpp" |
| … |
… |
|
| 44 | 45 | " <menuitem action=\"CloseDocument\" />" |
| 45 | 46 | " </menu>" |
| | 47 | " <menu action=\"MenuUser\">" |
| | 48 | " <menuitem action=\"UserSetPassword\" />" |
| | 49 | " </menu>" |
| 46 | 50 | " <menu action=\"MenuView\">" |
| 47 | 51 | " <menuitem action=\"ViewWordWrap\" />" |
| … |
… |
|
| 241 | 245 | *this, |
| 242 | 246 | &Header::on_app_document_close |
| | 247 | ) |
| | 248 | ); |
| | 249 | |
| | 250 | // User menu |
| | 251 | m_group_app->add(Gtk::Action::create("MenuUser", _("User")) ); |
| | 252 | |
| | 253 | // Set password |
| | 254 | m_group_app->add( |
| | 255 | Gtk::Action::create( |
| | 256 | "UserSetPassword", |
| | 257 | Gtk::Stock::DIALOG_AUTHENTICATION, |
| | 258 | _("Set password"), |
| | 259 | _("Sets a password for this user") |
| | 260 | ), |
| | 261 | sigc::mem_fun( |
| | 262 | *this, |
| | 263 | &Header::on_app_user_set_password |
| 243 | 264 | ) |
| 244 | 265 | ); |
| … |
… |
|
| 395 | 416 | m_group_app->get_action("CloseDocument")->set_sensitive(false); |
| 396 | 417 | m_group_app->get_action("QuitSession")->set_sensitive(false); |
| 397 | | #ifdef WITH_GTKSOURCEVIEW |
| | 418 | |
| | 419 | m_group_app->get_action("MenuUser")->set_sensitive(false); |
| 398 | 420 | m_group_app->get_action("MenuView")->set_sensitive(false); |
| 399 | | #endif |
| 400 | 421 | |
| 401 | 422 | // Connect to folder's signals |
| … |
… |
|
| 422 | 443 | m_group_app->get_action("SaveDocument")->set_sensitive(false); |
| 423 | 444 | m_group_app->get_action("CloseDocument")->set_sensitive(false); |
| 424 | | #ifdef WITH_GTKSOURCEVIEW |
| 425 | 445 | m_group_app->get_action("MenuView")->set_sensitive(false); |
| 426 | | #endif |
| 427 | 446 | } |
| 428 | 447 | |
| … |
… |
|
| 467 | 486 | { |
| 468 | 487 | return m_signal_document_close; |
| | 488 | } |
| | 489 | |
| | 490 | Gobby::Header::signal_user_set_password_type |
| | 491 | Gobby::Header::user_set_password_event() const |
| | 492 | { |
| | 493 | return m_signal_user_set_password; |
| 469 | 494 | } |
| 470 | 495 | |
| … |
… |
|
| 512 | 537 | m_group_app->get_action("OpenDocument")->set_sensitive(true); |
| 513 | 538 | |
| | 539 | // Enable password button if we are client |
| | 540 | m_group_app->get_action("MenuUser")->set_sensitive(true); |
| | 541 | m_group_app->get_action("UserSetPassword")->set_sensitive( |
| | 542 | dynamic_cast<obby::client_buffer*>(&buf) != NULL); |
| | 543 | |
| 514 | 544 | // Document actions will be activated from the insert_document event |
| 515 | 545 | m_group_app->get_action("SaveDocument")->set_sensitive(false); |
| … |
… |
|
| 526 | 556 | m_group_app->get_action("JoinSession")->set_sensitive(true); |
| 527 | 557 | m_group_app->get_action("QuitSession")->set_sensitive(false); |
| | 558 | |
| | 559 | // Disable user buttons |
| | 560 | m_group_app->get_action("MenuUser")->set_sensitive(false); |
| 528 | 561 | |
| 529 | 562 | // Disable document buttons |
| … |
… |
|
| 601 | 634 | { |
| 602 | 635 | m_signal_document_close.emit(); |
| | 636 | } |
| | 637 | |
| | 638 | void Gobby::Header::on_app_user_set_password() |
| | 639 | { |
| | 640 | m_signal_user_set_password.emit(); |
| 603 | 641 | } |
| 604 | 642 | |
-
|
r8b53940
|
r37d1c6c
|
|
| 27 | 27 | #include <gtkmm/stock.h> |
| 28 | 28 | |
| | 29 | #include <obby/format_string.hpp> |
| 29 | 30 | #include <obby/client_buffer.hpp> |
| 30 | 31 | #include <obby/host_buffer.hpp> |
| … |
… |
|
| 64 | 65 | sigc::mem_fun(*this, &Window::on_document_close) ); |
| 65 | 66 | |
| | 67 | m_header.user_set_password_event().connect( |
| | 68 | sigc::mem_fun(*this, &Window::on_user_set_password) ); |
| | 69 | |
| 66 | 70 | m_header.document_word_wrap_event().connect( |
| 67 | 71 | sigc::mem_fun(*this, &Window::on_document_word_wrap) ); |
| … |
… |
|
| 229 | 233 | buffer->global_password_event().connect( |
| 230 | 234 | sigc::mem_fun(*this, &Window::on_obby_global_password)); |
| | 235 | buffer->user_password_event().connect( |
| | 236 | sigc::mem_fun(*this, &Window::on_obby_user_password) ); |
| 231 | 237 | buffer->close_event().connect( |
| 232 | 238 | sigc::mem_fun(*this, &Window::on_obby_close) ); |
| … |
… |
|
| 234 | 240 | sigc::mem_fun(*this, &Window::on_obby_sync) ); |
| 235 | 241 | |
| 236 | | /* TODO: Connect to on_global_password to prompt for password */ |
| 237 | 242 | /* TODO: Add password entry widget in join dialog */ |
| 238 | 243 | /* TODO: Add password entry widget in host dialog */ |
| … |
… |
|
| 426 | 431 | } |
| 427 | 432 | |
| | 433 | void Gobby::Window::on_user_set_password() |
| | 434 | { |
| | 435 | // TODO: Password dialog with second entry field to confirm password |
| | 436 | EntryDialog dlg( |
| | 437 | *this, |
| | 438 | _("Set user password"), |
| | 439 | _("Enter new password") |
| | 440 | ); |
| | 441 | |
| | 442 | dlg.get_entry().set_visibility(false); |
| | 443 | |
| | 444 | if(dlg.run() == Gtk::RESPONSE_OK) |
| | 445 | { |
| | 446 | dynamic_cast<obby::client_buffer*>(m_buffer)->set_password( |
| | 447 | dlg.get_text() ); |
| | 448 | } |
| | 449 | } |
| | 450 | |
| 428 | 451 | void Gobby::Window::on_document_word_wrap() |
| 429 | 452 | { |
| … |
… |
|
| 499 | 522 | _("Password required"), |
| 500 | 523 | _("Enter session password") |
| | 524 | ); |
| | 525 | |
| | 526 | // Disable view of typed characters (password input) |
| | 527 | dlg.get_entry().set_visibility(false); |
| | 528 | if(dlg.run() == Gtk::RESPONSE_OK) |
| | 529 | { |
| | 530 | // Use given text as password |
| | 531 | password = dlg.get_text(); |
| | 532 | return true; |
| | 533 | } |
| | 534 | else |
| | 535 | { |
| | 536 | // Close connection otherwise |
| | 537 | on_session_quit(); |
| | 538 | return false; |
| | 539 | } |
| | 540 | } |
| | 541 | |
| | 542 | bool Gobby::Window::on_obby_user_password(std::string& password) |
| | 543 | { |
| | 544 | obby::format_string str(_("Enter user password for user %0") ); |
| | 545 | str << m_buffer->get_name(); |
| | 546 | |
| | 547 | // Prompt for password |
| | 548 | EntryDialog dlg( |
| | 549 | *this, |
| | 550 | _("Password required"), |
| | 551 | str.str() |
| 501 | 552 | ); |
| 502 | 553 | |