From 8fcaa914e11a1ab4cb6d4174bb3f6e1ddcd5700f Mon Sep 17 00:00:00 2001 From: Yann Leboulanger <asterix@lagaule.org> Date: Wed, 5 Aug 2009 20:53:58 +0200 Subject: [PATCH] ability to use anonymous authentication --- .../account_creation_wizard_window.glade | 169 ++++++++++----- data/glade/accounts_window.glade | 197 +++++++++++------- src/common/config.py | 1 + src/common/connection.py | 8 +- src/config.py | 195 ++++++++++------- 5 files changed, 363 insertions(+), 207 deletions(-) diff --git a/data/glade/account_creation_wizard_window.glade b/data/glade/account_creation_wizard_window.glade index 8458e66e6a..028492ba3f 100644 --- a/data/glade/account_creation_wizard_window.glade +++ b/data/glade/account_creation_wizard_window.glade @@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> -<!--*- mode: xml -*--> +<?xml version="1.0"?> <glade-interface> + <!-- interface-requires gtk+ 2.16 --> + <!-- interface-naming-policy toplevel-contextual --> <widget class="GtkWindow" id="account_creation_wizard_window"> <property name="border_width">12</property> <property name="title" translatable="yes">Gajim: Account Creation Wizard</property> @@ -30,13 +30,14 @@ to the Jabber network.</property> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> <widget class="GtkFrame" id="frame33"> <property name="visible">True</property> <property name="label_xalign">0</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> + <property name="shadow_type">none</property> <child> <widget class="GtkAlignment" id="alignment68"> <property name="visible">True</property> @@ -49,25 +50,26 @@ to the Jabber network.</property> <property name="spacing">6</property> <child> <widget class="GtkRadioButton" id="use_existing_account_radiobutton"> + <property name="label" translatable="yes">I already have an account I want to _use</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">I already have an account I want to _use</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> </widget> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> <widget class="GtkRadioButton" id="register_new_account_radiobutton"> + <property name="label" translatable="yes">I want to _register for a new account</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">I want to _register for a new account</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <property name="group">use_existing_account_radiobutton</property> </widget> @@ -105,8 +107,8 @@ to the Jabber network.</property> <property name="visible">True</property> </widget> <packing> - <property name="type">tab</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> <child> @@ -124,12 +126,13 @@ to the Jabber network.</property> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> <widget class="GtkTable" id="table27"> <property name="visible">True</property> - <property name="n_rows">2</property> + <property name="n_rows">3</property> <property name="n_columns">4</property> <property name="column_spacing">12</property> <property name="row_spacing">6</property> @@ -154,21 +157,21 @@ to the Jabber network.</property> <property name="mnemonic_widget">password_entry</property> </widget> <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> </child> <child> <widget class="GtkCheckButton" id="save_password_checkbutton"> + <property name="label" translatable="yes">Save pass_word</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">If checked, Gajim will remember the password for this account</property> - <property name="label" translatable="yes">Save pass_word</property> <property name="use_underline">True</property> <property name="focus_on_click">False</property> - <property name="response_id">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_save_password_checkbutton_toggled"/> @@ -176,8 +179,8 @@ to the Jabber network.</property> <packing> <property name="left_attach">2</property> <property name="right_attach">4</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> @@ -192,8 +195,8 @@ to the Jabber network.</property> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="y_options"></property> </packing> </child> @@ -225,10 +228,6 @@ to the Jabber network.</property> <child> <widget class="GtkComboBoxEntry" id="server_comboboxentry"> <property name="visible">True</property> - <child internal-child="entry"> - <widget class="GtkEntry" id="comboboxentry-entry1"> - </widget> - </child> </widget> <packing> <property name="left_attach">3</property> @@ -237,6 +236,26 @@ to the Jabber network.</property> <property name="y_options">GTK_FILL</property> </packing> </child> + <child> + <widget class="GtkCheckButton" id="anonymous_checkbutton1"> + <property name="label" translatable="yes">Anon_ymous authentication</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_anonymous_checkbutton1_toggled"/> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">4</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <placeholder/> + </child> </widget> <packing> <property name="expand">False</property> @@ -253,9 +272,9 @@ to the Jabber network.</property> <property name="visible">True</property> </widget> <packing> - <property name="type">tab</property> <property name="position">1</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> <child> @@ -273,6 +292,7 @@ to the Jabber network.</property> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -289,15 +309,12 @@ to the Jabber network.</property> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> <widget class="GtkComboBoxEntry" id="server_comboboxentry1"> <property name="visible">True</property> - <child internal-child="entry"> - <widget class="GtkEntry" id="comboboxentry-entry2"> - </widget> - </child> </widget> <packing> <property name="position">1</property> @@ -310,6 +327,20 @@ to the Jabber network.</property> <property name="position">1</property> </packing> </child> + <child> + <widget class="GtkCheckButton" id="anonymous_checkbutton2"> + <property name="label" translatable="yes">Anon_ymous authentication</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="position">2</property> + </packing> + </child> <child> <widget class="GtkExpander" id="expander1"> <property name="visible">True</property> @@ -347,11 +378,11 @@ to the Jabber network.</property> </child> <child> <widget class="GtkButton" id="manage_proxies_button"> + <property name="label" translatable="yes">Manage...</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Manage...</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_manage_proxies_button_clicked"/> </widget> <packing> @@ -363,11 +394,11 @@ to the Jabber network.</property> </child> <child> <widget class="GtkCheckButton" id="custom_host_port_checkbutton"> + <property name="label" translatable="yes">Use custom hostname/port</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Use custom hostname/port</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_custom_host_port_checkbutton_toggled"/> </widget> @@ -394,6 +425,7 @@ to the Jabber network.</property> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -454,7 +486,7 @@ to the Jabber network.</property> </child> </widget> <packing> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> </widget> @@ -467,9 +499,9 @@ to the Jabber network.</property> <property name="visible">True</property> </widget> <packing> - <property name="type">tab</property> <property name="position">2</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> <child> @@ -484,10 +516,11 @@ to the Jabber network.</property> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="stock">gtk-dialog-warning</property> - <property name="icon_size">5</property> + <property name="icon-size">5</property> </widget> <packing> <property name="expand">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -502,17 +535,18 @@ to the Jabber network.</property> </widget> <packing> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> <widget class="GtkCheckButton" id="ssl_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="label" translatable="yes">Add this certificate to the list of trusted certificates. SHA1 fingerprint of the certificate: </property> - <property name="response_id">0</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="draw_indicator">True</property> </widget> <packing> @@ -530,9 +564,9 @@ SHA1 fingerprint of the certificate: <property name="visible">True</property> </widget> <packing> - <property name="type">tab</property> <property name="position">3</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> <child> @@ -551,9 +585,9 @@ SHA1 fingerprint of the certificate: <property name="visible">True</property> </widget> <packing> - <property name="type">tab</property> <property name="position">4</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> <child> @@ -566,10 +600,11 @@ SHA1 fingerprint of the certificate: Please wait...</property> <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="justify">center</property> </widget> <packing> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -593,9 +628,9 @@ Please wait...</property> <property name="visible">True</property> </widget> <packing> - <property name="type">tab</property> <property name="position">5</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> <child> @@ -613,6 +648,7 @@ Please wait...</property> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -627,14 +663,17 @@ Please wait...</property> </packing> </child> </widget> + <packing> + <property name="position">0</property> + </packing> </child> <child> <widget class="GtkCheckButton" id="go_online_checkbutton"> + <property name="label" translatable="yes">Connect when I press Finish</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Connect when I press Finish</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> </widget> @@ -646,11 +685,11 @@ Please wait...</property> </child> <child> <widget class="GtkCheckButton" id="show_vcard_checkbutton"> + <property name="label" translatable="yes">Set my profile when I connect</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Set my profile when I connect</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> </widget> @@ -670,56 +709,68 @@ Please wait...</property> <property name="visible">True</property> </widget> <packing> - <property name="type">tab</property> <property name="position">6</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> </widget> + <packing> + <property name="position">0</property> + </packing> </child> <child> <widget class="GtkHButtonBox" id="hbuttonbox19"> <property name="visible">True</property> <property name="spacing">12</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> + <property name="layout_style">end</property> <child> <widget class="GtkButton" id="cancel_button"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> - <property name="label">gtk-cancel</property> + <property name="receives_default">False</property> <property name="use_stock">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_cancel_button_clicked"/> </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> </child> <child> <widget class="GtkButton" id="back_button"> + <property name="label">gtk-go-back</property> <property name="visible">True</property> <property name="sensitive">False</property> <property name="can_focus">True</property> <property name="can_default">True</property> - <property name="label">gtk-go-back</property> + <property name="receives_default">False</property> <property name="use_stock">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_back_button_clicked"/> </widget> <packing> + <property name="expand">False</property> + <property name="fill">False</property> <property name="position">1</property> </packing> </child> <child> <widget class="GtkButton" id="forward_button"> + <property name="label">gtk-go-forward</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> <property name="has_default">True</property> - <property name="label">gtk-go-forward</property> + <property name="receives_default">False</property> <property name="use_stock">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_forward_button_clicked"/> </widget> <packing> + <property name="expand">False</property> + <property name="fill">False</property> <property name="position">2</property> </packing> </child> @@ -727,8 +778,8 @@ Please wait...</property> <widget class="GtkButton" id="advanced_button"> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="receives_default">False</property> <property name="no_show_all">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_advanced_button_clicked"/> <child> <widget class="GtkAlignment" id="alignment96"> @@ -747,6 +798,7 @@ Please wait...</property> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -767,6 +819,8 @@ Please wait...</property> </child> </widget> <packing> + <property name="expand">False</property> + <property name="fill">False</property> <property name="position">3</property> </packing> </child> @@ -774,8 +828,8 @@ Please wait...</property> <widget class="GtkButton" id="finish_button"> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="receives_default">False</property> <property name="no_show_all">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_finish_button_clicked"/> <child> <widget class="GtkAlignment" id="alignment87"> @@ -794,6 +848,7 @@ Please wait...</property> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -814,6 +869,8 @@ Please wait...</property> </child> </widget> <packing> + <property name="expand">False</property> + <property name="fill">False</property> <property name="position">4</property> </packing> </child> diff --git a/data/glade/accounts_window.glade b/data/glade/accounts_window.glade index f74128ad92..55daa9acca 100644 --- a/data/glade/accounts_window.glade +++ b/data/glade/accounts_window.glade @@ -1,12 +1,12 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> -<!--*- mode: xml -*--> +<?xml version="1.0"?> <glade-interface> + <!-- interface-requires gtk+ 2.12 --> + <!-- interface-naming-policy toplevel-contextual --> <widget class="GtkWindow" id="accounts_window"> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="border_width">12</property> <property name="title" translatable="yes">Accounts</property> - <property name="default_width">700</property> + <property name="default_width">800</property> <signal name="destroy" handler="on_accounts_window_destroy"/> <signal name="key_press_event" handler="on_accounts_window_key_press_event"/> <child> @@ -30,9 +30,9 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="hscrollbar_policy">automatic</property> + <property name="vscrollbar_policy">automatic</property> + <property name="shadow_type">in</property> <child> <widget class="GtkTreeView" id="accounts_treeview"> <property name="visible">True</property> @@ -43,16 +43,18 @@ </widget> </child> </widget> + <packing> + <property name="position">0</property> + </packing> </child> <child> <widget class="GtkButton" id="add_button"> + <property name="label" translatable="yes">gtk-add</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-add</property> <property name="use_stock">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_add_button_clicked"/> </widget> <packing> @@ -62,13 +64,12 @@ </child> <child> <widget class="GtkButton" id="remove_button"> + <property name="label" translatable="yes">gtk-remove</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-remove</property> <property name="use_stock">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_remove_button_clicked"/> </widget> <packing> @@ -82,7 +83,6 @@ <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_rename_button_clicked"/> <child> <widget class="GtkHBox" id="hbox8"> @@ -96,6 +96,7 @@ </widget> <packing> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -177,7 +178,7 @@ <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> - <widget class="GtkLabel" id="label2"> + <widget class="GtkLabel" id="jid_label1"> <property name="visible">True</property> <property name="xalign">0</property> <property name="label" translatable="yes">_Jabber ID:</property> @@ -224,13 +225,13 @@ </child> <child> <widget class="GtkCheckButton" id="save_password_checkbutton1"> + <property name="label" translatable="yes">Save pass_word</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">If checked, Gajim will remember the password for this account</property> - <property name="label" translatable="yes">Save pass_word</property> <property name="use_underline">True</property> <property name="focus_on_click">False</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_save_password_checkbutton1_toggled"/> </widget> @@ -275,12 +276,12 @@ </child> <child> <widget class="GtkCheckButton" id="adjust_priority_with_status_checkbutton1"> + <property name="label" translatable="yes">A_djust to status</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">Priority will change automatically according to your status.</property> - <property name="label" translatable="yes">A_djust to status</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_adjust_priority_with_status_checkbutton1_toggled"/> </widget> @@ -323,26 +324,27 @@ <property name="homogeneous">True</property> <child> <widget class="GtkButton" id="synchronise_contacts_button1"> + <property name="label" translatable="yes">Synchronise contacts</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">Click to request authorization to all contacts of another account</property> - <property name="label" translatable="yes">Synchronise contacts</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_synchronise_contacts_button1_clicked"/> </widget> <packing> <property name="expand">False</property> + <property name="position">0</property> </packing> </child> <child> <widget class="GtkButton" id="change_password_button1"> + <property name="label" translatable="yes">Chan_ge Password</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">Click to change account's password</property> - <property name="label" translatable="yes">Chan_ge Password</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_change_password_button1_clicked"/> </widget> <packing> @@ -379,7 +381,7 @@ </widget> <packing> <property name="left_attach">1</property> - <property name="right_attach">3</property> + <property name="right_attach">2</property> <property name="y_options"></property> </packing> </child> @@ -400,6 +402,22 @@ <property name="y_options"></property> </packing> </child> + <child> + <widget class="GtkCheckButton" id="anonymous_checkbutton1"> + <property name="label" translatable="yes">Anonymous authentication</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_anonymous_checkbutton1_toggled"/> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> </widget> </child> <child> @@ -408,8 +426,8 @@ <property name="label" translatable="yes">Account</property> </widget> <packing> - <property name="type">tab</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> <child> @@ -419,27 +437,28 @@ <property name="spacing">6</property> <child> <widget class="GtkCheckButton" id="autoconnect_checkbutton1"> + <property name="label" translatable="yes">C_onnect on Gajim startup</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">If checked, Gajim, when launched, will automatically connect to jabber using this account</property> - <property name="label" translatable="yes">C_onnect on Gajim startup</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_autoconnect_checkbutton_toggled"/> </widget> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> <widget class="GtkCheckButton" id="autoreconnect_checkbutton1"> + <property name="label" translatable="yes">Auto-reconnect when connection is lost</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Auto-reconnect when connection is lost</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_autoreconnect_checkbutton_toggled"/> </widget> @@ -451,11 +470,11 @@ </child> <child> <widget class="GtkCheckButton" id="log_history_checkbutton1"> + <property name="label" translatable="yes">Save conversation _logs for all contacts</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Save conversation _logs for all contacts</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_log_history_checkbutton_toggled"/> @@ -468,12 +487,12 @@ </child> <child> <widget class="GtkCheckButton" id="sync_with_global_status_checkbutton1"> + <property name="label" translatable="yes">Synch_ronize account status with global status</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">If checked, any change to the global status (handled by the combobox at the bottom of the roster window) will change the status of this account accordingly</property> - <property name="label" translatable="yes">Synch_ronize account status with global status</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_sync_with_global_status_checkbutton_toggled"/> </widget> @@ -485,12 +504,12 @@ </child> <child> <widget class="GtkCheckButton" id="use_ft_proxies_checkbutton1"> + <property name="label" translatable="yes">Use file transfer proxies</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">If checked, Gajim will also broadcast some more IPs except from just your IP, so file transfer has higher chances of working.</property> - <property name="label" translatable="yes">Use file transfer proxies</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_use_ft_proxies_checkbutton1_toggled"/> </widget> @@ -512,9 +531,9 @@ <property name="use_markup">True</property> </widget> <packing> - <property name="type">tab</property> <property name="position">1</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> <child> @@ -527,7 +546,7 @@ <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="label_xalign">0</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> + <property name="shadow_type">none</property> <child> <widget class="GtkAlignment" id="alignment4"> <property name="visible">True</property> @@ -541,17 +560,18 @@ <property name="spacing">6</property> <child> <widget class="GtkCheckButton" id="use_env_http_proxy_checkbutton1"> + <property name="label" translatable="yes">_use HTTP__PROXY environment variable</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">_use HTTP__PROXY environment variable</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_use_env_http_proxy_checkbutton1_toggled"/> </widget> <packing> <property name="expand">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -564,14 +584,17 @@ <property name="items" translatable="yes" comments="None means no proxy profile selected">None</property> <signal name="changed" handler="on_proxies_combobox1_changed"/> </widget> + <packing> + <property name="position">0</property> + </packing> </child> <child> <widget class="GtkButton" id="manage_proxies_button1"> + <property name="label" translatable="yes">_Manage...</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">_Manage...</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_manage_proxies_button1_clicked"/> </widget> <packing> @@ -602,12 +625,15 @@ </packing> </child> </widget> + <packing> + <property name="position">0</property> + </packing> </child> <child> <widget class="GtkFrame" id="misc_frame1"> <property name="visible">True</property> <property name="label_xalign">0</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> + <property name="shadow_type">none</property> <child> <widget class="GtkAlignment" id="alignment1"> <property name="visible">True</property> @@ -619,28 +645,29 @@ <property name="spacing">6</property> <child> <widget class="GtkCheckButton" id="warn_when_insecure_connection_checkbutton1"> + <property name="label" translatable="yes">_Warn before using an insecure connection</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">Check this so Gajim will ask you before sending your password over an insecure connection.</property> - <property name="label" translatable="yes">_Warn before using an insecure connection</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_warn_when_insecure_connection_checkbutton1_toggled"/> </widget> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> <widget class="GtkCheckButton" id="send_keepalive_checkbutton1"> + <property name="label" translatable="yes">Send _keep-alive packets</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">If checked, Gajim will send keep-alive packets to prevent connection timeout which results in disconnection</property> - <property name="label" translatable="yes">Send _keep-alive packets</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_send_keepalive_checkbutton1_toggled"/> @@ -653,11 +680,11 @@ </child> <child> <widget class="GtkCheckButton" id="custom_host_port_checkbutton1"> + <property name="label" translatable="yes">Use cust_om hostname/port</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Use cust_om hostname/port</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_custom_host_port_checkbutton1_toggled"/> </widget> @@ -681,6 +708,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -754,9 +782,9 @@ <property name="label" translatable="yes">Connection</property> </widget> <packing> - <property name="type">tab</property> <property name="position">2</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> <child> @@ -768,7 +796,7 @@ <widget class="GtkFrame" id="frame1"> <property name="visible">True</property> <property name="label_xalign">0</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> + <property name="shadow_type">none</property> <child> <widget class="GtkAlignment" id="alignment2"> <property name="visible">True</property> @@ -792,6 +820,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -806,11 +835,11 @@ </child> <child> <widget class="GtkButton" id="gpg_choose_button1"> + <property name="label" translatable="yes">Choose _Key...</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Choose _Key...</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_gpg_choose_button_clicked"/> </widget> <packing> @@ -822,17 +851,18 @@ </widget> <packing> <property name="expand">False</property> + <property name="position">0</property> </packing> </child> <child> <widget class="GtkCheckButton" id="use_gpg_agent_checkbutton1"> + <property name="label" translatable="yes">Use G_PG Agent</property> <property name="visible">True</property> <property name="sensitive">False</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">If checked, Gajim will get the password from a GPG agent like seahorse</property> - <property name="label" translatable="yes">Use G_PG Agent</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_use_gpg_agent_checkbutton_toggled"/> </widget> @@ -859,13 +889,14 @@ </widget> <packing> <property name="expand">False</property> + <property name="position">0</property> </packing> </child> <child> <widget class="GtkFrame" id="frame2"> <property name="visible">True</property> <property name="label_xalign">0</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> + <property name="shadow_type">none</property> <child> <widget class="GtkAlignment" id="alignment3"> <property name="visible">True</property> @@ -873,12 +904,12 @@ <property name="left_padding">12</property> <child> <widget class="GtkButton" id="edit_details_button1"> + <property name="label" translatable="yes">_Edit Personal Information...</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">Information about you, as stored in the server</property> - <property name="label" translatable="yes">_Edit Personal Information...</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_edit_details_button1_clicked"/> </widget> </child> @@ -911,9 +942,9 @@ <property name="label" translatable="yes">Personal Information</property> </widget> <packing> - <property name="type">tab</property> <property name="position">3</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> </widget> @@ -933,17 +964,18 @@ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> <widget class="GtkCheckButton" id="enable_zeroconf_checkbutton2"> + <property name="label" translatable="yes">_Enable</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">_Enable</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_enable_zeroconf_checkbutton2_toggled"/> </widget> <packing> <property name="expand">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -957,27 +989,28 @@ <property name="spacing">6</property> <child> <widget class="GtkCheckButton" id="autoconnect_checkbutton2"> + <property name="label" translatable="yes">Co_nnect on Gajim startup</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">If checked, Gajim, when launched, will automatically connect to jabber using this account</property> - <property name="label" translatable="yes">Co_nnect on Gajim startup</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_autoconnect_checkbutton_toggled"/> </widget> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> <widget class="GtkCheckButton" id="log_history_checkbutton2"> + <property name="label" translatable="yes">Save conversation _logs for all contacts</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Save conversation _logs for all contacts</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_log_history_checkbutton_toggled"/> </widget> @@ -989,12 +1022,12 @@ </child> <child> <widget class="GtkCheckButton" id="sync_with_global_status_checkbutton2"> + <property name="label" translatable="yes">Synchroni_ze account status with global status</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">If checked, any change to the global status (handled by the combobox at the bottom of the roster window) will change the status of this account accordingly</property> - <property name="label" translatable="yes">Synchroni_ze account status with global status</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_sync_with_global_status_checkbutton_toggled"/> </widget> @@ -1009,19 +1042,20 @@ <property name="visible">True</property> <child> <widget class="GtkCheckButton" id="custom_port_checkbutton2"> + <property name="label" translatable="yes">Use cust_om port:</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">If the default port that is used for incoming messages is unfitting for your setup you can select another one here. You might consider to change possible firewall settings.</property> - <property name="label" translatable="yes">Use cust_om port:</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_custom_port_checkbutton2_toggled"/> </widget> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -1053,8 +1087,8 @@ You might consider to change possible firewall settings.</property> <property name="use_markup">True</property> </widget> <packing> - <property name="type">tab</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> <child> @@ -1079,6 +1113,7 @@ You might consider to change possible firewall settings.</property> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -1093,6 +1128,7 @@ You might consider to change possible firewall settings.</property> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -1105,11 +1141,11 @@ You might consider to change possible firewall settings.</property> </child> <child> <widget class="GtkButton" id="gpg_choose_button2"> + <property name="label" translatable="yes">Choose _Key...</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Choose _Key...</property> + <property name="receives_default">False</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_gpg_choose_button_clicked"/> </widget> <packing> @@ -1125,12 +1161,12 @@ You might consider to change possible firewall settings.</property> </child> <child> <widget class="GtkCheckButton" id="use_gpg_agent_checkbutton2"> + <property name="label" translatable="yes">Use G_PG Agent</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="tooltip" translatable="yes">If checked, Gajim will get the password from a GPG agent like seahorse</property> - <property name="label" translatable="yes">Use G_PG Agent</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="on_use_gpg_agent_checkbutton_toggled"/> </widget> @@ -1276,9 +1312,9 @@ You might consider to change possible firewall settings.</property> <property name="label" translatable="yes">Personal Information</property> </widget> <packing> - <property name="type">tab</property> <property name="position">1</property> <property name="tab_fill">False</property> + <property name="type">tab</property> </packing> </child> </widget> @@ -1304,15 +1340,18 @@ You might consider to change possible firewall settings.</property> </packing> </child> </widget> + <packing> + <property name="position">0</property> + </packing> </child> <child> <widget class="GtkCheckButton" id="merge_checkbutton"> + <property name="label" translatable="yes">Mer_ge accounts</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Mer_ge accounts</property> <property name="use_underline">True</property> - <property name="response_id">0</property> <property name="draw_indicator">True</property> </widget> <packing> @@ -1325,18 +1364,22 @@ You might consider to change possible firewall settings.</property> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="spacing">6</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> + <property name="layout_style">end</property> <child> <widget class="GtkButton" id="close_button"> + <property name="label" translatable="yes">gtk-close</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">gtk-close</property> <property name="use_stock">True</property> - <property name="response_id">0</property> <signal name="clicked" handler="on_close_button_clicked"/> </widget> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> </child> </widget> <packing> diff --git a/src/common/config.py b/src/common/config.py index 4e5104ddaa..ff780715a3 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -265,6 +265,7 @@ class Config: 'accounts': ({ 'name': [ opt_str, '', '', True ], 'hostname': [ opt_str, '', '', True ], + 'anonymous_auth': [ opt_bool, False ], 'savepass': [ opt_bool, False ], 'password': [ opt_str, '' ], 'resource': [ opt_str, 'gajim', '', True ], diff --git a/src/common/connection.py b/src/common/connection.py index c155bd1a2e..1fb866ade2 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -700,7 +700,10 @@ class Connection(ConnectionHandlers): self._current_host['host'], self._current_host['port'], con_type)) self.last_connection_type = con_type - name = gajim.config.get_per('accounts', self.name, 'name') + if gajim.config.get_per('accounts', self.name, 'anonymous_auth'): + name = None + else: + name = gajim.config.get_per('accounts', self.name, 'name') hostname = gajim.config.get_per('accounts', self.name, 'hostname') self.connection = con try: @@ -775,6 +778,9 @@ class Connection(ConnectionHandlers): return if hasattr(con, 'Resource'): self.server_resource = con.Resource + if gajim.config.get_per('accounts', self.name, 'anonymous_auth'): + # Get jid given by server + gajim.config.set_per('accounts', self.name, 'name', con.User) if auth: self.last_io = gajim.idlequeue.current_time() self.connected = 2 diff --git a/src/config.py b/src/config.py index 2fcad148d0..43f030bc1b 100644 --- a/src/config.py +++ b/src/config.py @@ -1553,23 +1553,44 @@ class AccountsWindow: use_gpg_agent_checkbutton.set_sensitive(True) use_gpg_agent_checkbutton.set_active(use_gpg_agent) - def init_normal_account(self): + def draw_normal_jid(self): account = self.current_account - # Account tab - jid = gajim.config.get_per('accounts', account, 'name') \ - + '@' + gajim.config.get_per('accounts', account, 'hostname') - self.xml.get_widget('jid_entry1').set_text(jid) - savepass = gajim.config.get_per('accounts', account, 'savepass') - self.xml.get_widget('save_password_checkbutton1').set_active(savepass) - password_entry = self.xml.get_widget('password_entry1') - if savepass: - passstr = passwords.get_password(account) or '' - password_entry.set_sensitive(True) - else: - passstr = '' + self.ignore_events = True + if gajim.config.get_per('accounts', account, 'anonymous_auth'): + self.xml.get_widget('anonymous_checkbutton1').set_active(True) + self.xml.get_widget('jid_label1').set_text(_('Server:')) + save_password = self.xml.get_widget('save_password_checkbutton1') + save_password.set_active(False) + save_password.set_sensitive(False) + password_entry = self.xml.get_widget('password_entry1') + password_entry.set_text('') password_entry.set_sensitive(False) - password_entry.set_text(passstr) + jid = gajim.config.get_per('accounts', account, 'hostname') + else: + self.xml.get_widget('anonymous_checkbutton1').set_active(False) + self.xml.get_widget('jid_label1').set_text(_('Jabber ID:')) + savepass = gajim.config.get_per('accounts', account, 'savepass') + save_password = self.xml.get_widget('save_password_checkbutton1') + save_password.set_sensitive(True) + save_password.set_active(savepass) + password_entry = self.xml.get_widget('password_entry1') + if savepass: + passstr = passwords.get_password(account) or '' + password_entry.set_sensitive(True) + else: + passstr = '' + password_entry.set_sensitive(False) + password_entry.set_text(passstr) + jid = gajim.config.get_per('accounts', account, 'name') \ + + '@' + gajim.config.get_per('accounts', account, 'hostname') + self.xml.get_widget('jid_entry1').set_text(jid) + self.ignore_events = False + + def init_normal_account(self): + account = self.current_account + # Account tab + self.draw_normal_jid() self.xml.get_widget('resource_entry1').set_text(gajim.config.get_per( 'accounts', account, 'resource')) self.xml.get_widget('adjust_priority_with_status_checkbutton1').\ @@ -1817,7 +1838,8 @@ class AccountsWindow: return True jid_splited = jid.split('@', 1) - if len(jid_splited) != 2: + if len(jid_splited) != 2 and not gajim.config.get_per('accounts', + self.current_account, 'anonymous_auth'): if not widget.is_focus(): pritext = _('Invalid Jabber ID') sectext = _('A Jabber ID must be in the form "user@servername".') @@ -1825,14 +1847,30 @@ class AccountsWindow: gobject.idle_add(lambda: widget.grab_focus()) return True - if self.option_changed('name', jid_splited[0]) or \ - self.option_changed('hostname', jid_splited[1]): - self.need_relogin = True - gajim.config.set_per('accounts', self.current_account, 'name', - jid_splited[0]) - gajim.config.set_per('accounts', self.current_account, 'hostname', - jid_splited[1]) + if gajim.config.get_per('accounts', self.current_account, + 'anonymous_auth'): + gajim.config.set_per('accounts', self.current_account, 'hostname', + jid_splited[0]) + if self.option_changed('hostname', jid_splited[0]): + self.need_relogin = True + else: + if self.option_changed('name', jid_splited[0]) or \ + self.option_changed('hostname', jid_splited[1]): + self.need_relogin = True + + gajim.config.set_per('accounts', self.current_account, 'name', + jid_splited[0]) + gajim.config.set_per('accounts', self.current_account, 'hostname', + jid_splited[1]) + + def on_anonymous_checkbutton1_toggled(self, widget): + if self.ignore_events: + return + active = widget.get_active() + gajim.config.set_per('accounts', self.current_account, 'anonymous_auth', + active) + self.draw_normal_jid() def on_password_entry1_changed(self, widget): if self.ignore_events: @@ -3077,6 +3115,42 @@ class AccountCreationWizardWindow: else: self.notebook.set_current_page(2) # Go to server page + def on_anonymous_checkbutton1_toggled(self, widget): + active = widget.get_active() + self.xml.get_widget('username_entry').set_sensitive(not active) + self.xml.get_widget('password_entry').set_sensitive(not active) + self.xml.get_widget('save_password_checkbutton').set_sensitive(not active) + + def show_finish_page(self): + self.cancel_button.hide() + self.back_button.hide() + self.forward_button.hide() + if self.modify: + finish_text = '<big><b>%s</b></big>\n\n%s' % ( + _('Account has been added successfully'), + _('You can set advanced account options by pressing the ' + 'Advanced button, or later by choosing the Accounts menuitem ' + 'under the Edit menu from the main window.')) + else: + finish_text = '<big><b>%s</b></big>\n\n%s' % ( + _('Your new account has been created successfully'), + _('You can set advanced account options by pressing the Advanced ' + 'button, or later by choosing the Accounts menuitem under the Edit ' + 'menu from the main window.')) + self.finish_label.set_markup(finish_text) + self.finish_button.show() + self.finish_button.set_property('has-default', True) + self.advanced_button.show() + self.go_online_checkbutton.show() + img = self.xml.get_widget('finish_image') + if self.modify: + img.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_DIALOG) + else: + path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps', 'gajim.png') + img.set_from_file(path_to_file) + self.show_vcard_checkbutton.set_active(not self.modify) + self.notebook.set_current_page(6) # show finish page + def on_forward_button_clicked(self, widget): cur_page = self.notebook.get_current_page() @@ -3093,9 +3167,10 @@ class AccountCreationWizardWindow: elif cur_page == 1: # We are adding an existing account + anonymous = self.xml.get_widget('anonymous_checkbutton1').get_active() username = self.xml.get_widget('username_entry').get_text().decode( 'utf-8').strip() - if not username: + if not username and not anonymous: pritext = _('Invalid username') sectext = _( 'You must provide a username to configure this account.') @@ -3124,25 +3199,11 @@ class AccountCreationWizardWindow: i += 1 username, server = gajim.get_name_and_server_from_jid(jid) - self.save_account(username, server, savepass, password) - self.cancel_button.hide() - self.back_button.hide() - self.forward_button.hide() - if self.modify: - finish_text = '<big><b>%s</b></big>\n\n%s' % ( - _('Account has been added successfully'), - _('You can set advanced account options by pressing the ' - 'Advanced button, or later by choosing the Accounts menuitem ' - 'under the Edit menu from the main window.')) - self.finish_label.set_markup(finish_text) - self.finish_button.show() - self.finish_button.set_property('has-default', True) - self.advanced_button.show() - self.go_online_checkbutton.show() - img = self.xml.get_widget('finish_image') - img.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_DIALOG) - self.notebook.set_current_page(6) # show finish page - self.show_vcard_checkbutton.set_active(False) + if self.xml.get_widget('anonymous_checkbutton1').get_active(): + self.save_account('', server, False, '', anonymous=True) + else: + self.save_account(username, server, savepass, password) + self.show_finish_page() elif cur_page == 2: # We are creating a new account server = self.xml.get_widget('server_comboboxentry1').child.get_text()\ @@ -3180,15 +3241,20 @@ class AccountCreationWizardWindow: config['custom_host'] = self.xml.get_widget( 'custom_host_entry').get_text().decode('utf-8') - self.notebook.set_current_page(5) # show creating page - self.back_button.hide() - self.forward_button.hide() - self.update_progressbar_timeout_id = gobject.timeout_add(100, - self.update_progressbar) - # Get form from serveur - con = connection.Connection(self.account) - gajim.connections[self.account] = con - con.new_account(self.account, config) + if self.xml.get_widget('anonymous_checkbutton2').get_active(): + self.modify = True + self.save_account('', server, False, '', anonymous=True) + self.show_finish_page() + else: + self.notebook.set_current_page(5) # show creating page + self.back_button.hide() + self.forward_button.hide() + self.update_progressbar_timeout_id = gobject.timeout_add(100, + self.update_progressbar) + # Get form from serveur + con = connection.Connection(self.account) + gajim.connections[self.account] = con + con.new_account(self.account, config) elif cur_page == 3: checked = self.xml.get_widget('ssl_checkbutton').get_active() if checked: @@ -3308,25 +3374,7 @@ class AccountCreationWizardWindow: def acc_is_ok(self, config): '''Account creation succeeded''' self.create_vars(config) - self.cancel_button.hide() - self.back_button.hide() - self.forward_button.hide() - self.finish_button.show() - self.finish_button.set_property('has-default', True) - self.advanced_button.show() - self.go_online_checkbutton.show() - self.show_vcard_checkbutton.show() - img = self.xml.get_widget('finish_image') - path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps', 'gajim.png') - img.set_from_file(path_to_file) - - finish_text = '<big><b>%s</b></big>\n\n%s' % ( - _('Your new account has been created successfully'), - _('You can set advanced account options by pressing the Advanced ' - 'button, or later by choosing the Accounts menuitem under the Edit ' - 'menu from the main window.')) - self.finish_label.set_markup(finish_text) - self.notebook.set_current_page(6) # show finish page + self.show_finish_page() if self.update_progressbar_timeout_id is not None: gobject.source_remove(self.update_progressbar_timeout_id) @@ -3386,13 +3434,14 @@ class AccountCreationWizardWindow: username_entry.set_position(-1) return True - def get_config(self, login, server, savepass, password): + def get_config(self, login, server, savepass, password, anonymous=False): config = {} config['name'] = login config['hostname'] = server config['savepass'] = savepass config['password'] = password config['resource'] = 'Gajim' + config['anonymous_auth'] = anonymous config['priority'] = 5 config['autoconnect'] = True config['no_log_for'] = '' @@ -3406,7 +3455,7 @@ class AccountCreationWizardWindow: config['keyid'] = '' return config - def save_account(self, login, server, savepass, password): + def save_account(self, login, server, savepass, password, anonymous=False): if self.account in gajim.connections: dialogs.ErrorDialog(_('Account name is in use'), _('You already have an account using this name.')) @@ -3414,7 +3463,7 @@ class AccountCreationWizardWindow: con = connection.Connection(self.account) con.password = password - config = self.get_config(login, server, savepass, password) + config = self.get_config(login, server, savepass, password, anonymous) if not self.modify: con.new_account(self.account, config) -- GitLab