Philipp Hörist pushed to branch gajim_1.2 at gajim / gajim

Commits:

15 changed files:

Changes:

  • gajim/common/app.py
    ... ... @@ -115,9 +115,6 @@ nicks = {} # type: Dict[str, str]
    115 115
     # from this transport
    
    116 116
     block_signed_in_notifications = {}  # type: Dict[str, bool]
    
    117 117
     
    
    118
    - # type of each connection (ssl, tls, tcp, ...)
    
    119
    -con_types = {}  # type: Dict[str, Optional[str]]
    
    120
    -
    
    121 118
     proxy65_manager = None
    
    122 119
     
    
    123 120
     cert_store = None
    
    ... ... @@ -466,21 +463,6 @@ def in_groupchat(account, room_jid):
    466 463
             return False
    
    467 464
         return gc_connected[account][room_jid]
    
    468 465
     
    
    469
    -def get_number_of_securely_connected_accounts():
    
    470
    -    """
    
    471
    -    Return the number of the accounts that are SSL/TLS connected
    
    472
    -    """
    
    473
    -    num_of_secured = 0
    
    474
    -    for account in connections:
    
    475
    -        if account_is_securely_connected(account):
    
    476
    -            num_of_secured += 1
    
    477
    -    return num_of_secured
    
    478
    -
    
    479
    -def account_is_securely_connected(account):
    
    480
    -    if not account_is_connected(account):
    
    481
    -        return False
    
    482
    -    return con_types.get(account) in ('tls', 'ssl')
    
    483
    -
    
    484 466
     def get_transport_name_from_jid(jid, use_config_setting=True):
    
    485 467
         """
    
    486 468
         Returns 'gg', 'irc' etc
    

  • gajim/common/cert_store.py
    ... ... @@ -62,6 +62,7 @@ class CertificateStore:
    62 62
     
    
    63 63
         def add_certificate(self, certificate):
    
    64 64
             log.info('Add certificate to trust store')
    
    65
    +        self._certs.append(certificate)
    
    65 66
             pem = certificate.props.certificate_pem
    
    66 67
             path = self._get_random_path()
    
    67 68
             write_file_async(path,
    

  • gajim/common/client.py
    ... ... @@ -33,7 +33,7 @@ from gajim.common.helpers import get_custom_host
    33 33
     from gajim.common.helpers import get_user_proxy
    
    34 34
     from gajim.common.helpers import warn_about_plain_connection
    
    35 35
     from gajim.common.helpers import get_resource
    
    36
    -from gajim.common.helpers import get_ignored_ssl_errors
    
    36
    +from gajim.common.helpers import get_ignored_tls_errors
    
    37 37
     from gajim.common.helpers import get_idle_status_message
    
    38 38
     from gajim.common.idle import Monitor
    
    39 39
     from gajim.common.i18n import _
    
    ... ... @@ -79,7 +79,7 @@ class Client(ConnectionHandlers):
    79 79
             self._destroy_client = False
    
    80 80
             self._remove_account = False
    
    81 81
     
    
    82
    -        self._ssl_errors = set()
    
    82
    +        self._tls_errors = set()
    
    83 83
     
    
    84 84
             self._destroyed = False
    
    85 85
     
    
    ... ... @@ -178,7 +178,7 @@ class Client(ConnectionHandlers):
    178 178
                 app.cert_store.get_certificates())
    
    179 179
     
    
    180 180
             self._client.set_ignored_tls_errors(
    
    181
    -            get_ignored_ssl_errors(self._account))
    
    181
    +            get_ignored_tls_errors(self._account))
    
    182 182
     
    
    183 183
             if app.config.get_per('accounts', self._account,
    
    184 184
                                   'use_plain_connection'):
    
    ... ... @@ -200,8 +200,8 @@ class Client(ConnectionHandlers):
    200 200
             for handler in modules.get_handlers(self):
    
    201 201
                 self._client.register_handler(handler)
    
    202 202
     
    
    203
    -    def process_ssl_errors(self):
    
    204
    -        if not self._ssl_errors:
    
    203
    +    def process_tls_errors(self):
    
    204
    +        if not self._tls_errors:
    
    205 205
                 self.connect(ignore_all_errors=True)
    
    206 206
                 return
    
    207 207
     
    
    ... ... @@ -209,7 +209,7 @@ class Client(ConnectionHandlers):
    209 209
                         account=self._account,
    
    210 210
                         connection=self,
    
    211 211
                         cert=self._client.peer_certificate[0],
    
    212
    -                    error_num=self._ssl_errors.pop())
    
    212
    +                    error_num=self._tls_errors.pop())
    
    213 213
     
    
    214 214
         def _on_resume_failed(self, _client, _signal_name):
    
    215 215
             log.info('Resume failed')
    
    ... ... @@ -261,13 +261,13 @@ class Client(ConnectionHandlers):
    261 261
                 self._reconnect = False
    
    262 262
     
    
    263 263
             elif domain == StreamError.BAD_CERTIFICATE:
    
    264
    -            self._ssl_errors = self._client.peer_certificate[1]
    
    264
    +            self._tls_errors = self._client.peer_certificate[1]
    
    265 265
                 self.get_module('Chatstate').enabled = False
    
    266 266
                 self._reconnect = False
    
    267 267
                 self._after_disconnect()
    
    268 268
                 app.nec.push_incoming_event(NetworkEvent(
    
    269 269
                     'our-show', account=self._account, show='offline'))
    
    270
    -            self.process_ssl_errors()
    
    270
    +            self.process_tls_errors()
    
    271 271
     
    
    272 272
             elif domain in (StreamError.STREAM, StreamError.BIND):
    
    273 273
                 if error == 'conflict':
    

  • gajim/common/dbus/music_track.py
    ... ... @@ -85,10 +85,8 @@ class MusicTrackListener:
    85 85
                     -1,
    
    86 86
                     None)
    
    87 87
             except GLib.Error as error:
    
    88
    -            if error.domain == 'g-dbus-error-quark':
    
    89
    -                log.debug("Could not list names: %s", error.message)
    
    90
    -                return
    
    91
    -            raise
    
    88
    +            log.debug("Could not list names: %s", error.message)
    
    89
    +            return
    
    92 90
     
    
    93 91
             for name in result[0]:
    
    94 92
                 if name.startswith(MPRIS_PLAYER_PREFIX):
    
    ... ... @@ -199,12 +197,10 @@ class MusicTrackListener:
    199 197
                     -1,
    
    200 198
                     None)
    
    201 199
             except GLib.Error as error:
    
    202
    -            if error.domain == 'g-dbus-error-quark':
    
    203
    -                log.debug("Could not enable music listener: %s", error.message)
    
    204
    -                return None
    
    205
    -            raise
    
    206
    -        else:
    
    207
    -            return self._get_music_info(result[0])
    
    200
    +            log.debug("Could not enable music listener: %s", error.message)
    
    201
    +            return None
    
    202
    +
    
    203
    +        return self._get_music_info(result[0])
    
    208 204
     
    
    209 205
     
    
    210 206
     def enable():
    

  • gajim/common/helpers.py
    ... ... @@ -1545,7 +1545,7 @@ def warn_about_plain_connection(account, connection_types):
    1545 1545
         return False
    
    1546 1546
     
    
    1547 1547
     
    
    1548
    -def get_ignored_ssl_errors(account):
    
    1548
    +def get_ignored_tls_errors(account):
    
    1549 1549
         ignore_ssl_errors = app.config.get_per(
    
    1550 1550
             'accounts', account, 'ignore_ssl_errors').split()
    
    1551 1551
         return {Gio.TlsCertificateFlags(int(err)) for err in ignore_ssl_errors}
    

  • gajim/data/gui/message_window.ui
    1 1
     <?xml version="1.0" encoding="UTF-8"?>
    
    2
    -<!-- Generated with glade 3.22.1 -->
    
    2
    +<!-- Generated with glade 3.36.0 -->
    
    3 3
     <interface>
    
    4
    -  <requires lib="gtk+" version="3.12"/>
    
    4
    +  <requires lib="gtk+" version="3.22"/>
    
    5 5
       <object class="GtkEventBox" id="chat_tab_ebox">
    
    6 6
         <property name="visible">True</property>
    
    7 7
         <property name="can_focus">False</property>
    
    ... ... @@ -17,7 +17,6 @@
    17 17
                 <property name="visible">True</property>
    
    18 18
                 <property name="can_focus">False</property>
    
    19 19
                 <property name="halign">start</property>
    
    20
    -            <property name="stock">gtk-missing-image</property>
    
    21 20
               </object>
    
    22 21
               <packing>
    
    23 22
                 <property name="expand">False</property>
    
    ... ... @@ -30,8 +29,7 @@
    30 29
                 <property name="visible">True</property>
    
    31 30
                 <property name="can_focus">False</property>
    
    32 31
                 <property name="halign">start</property>
    
    33
    -            <property name="margin_left">3</property>
    
    34
    -            <property name="hexpand">True</property>
    
    32
    +            <property name="margin_start">3</property>
    
    35 33
                 <property name="use_markup">True</property>
    
    36 34
                 <property name="ellipsize">end</property>
    
    37 35
                 <property name="single_line_mode">True</property>
    
    ... ... @@ -48,17 +46,16 @@
    48 46
             </child>
    
    49 47
             <child>
    
    50 48
               <object class="GtkButton" id="tab_close_button">
    
    51
    -            <property name="use_action_appearance">False</property>
    
    52 49
                 <property name="visible">True</property>
    
    53 50
                 <property name="can_focus">True</property>
    
    54 51
                 <property name="receives_default">True</property>
    
    55 52
                 <property name="halign">end</property>
    
    56 53
                 <property name="relief">none</property>
    
    57 54
                 <child>
    
    58
    -              <object class="GtkImage" id="image1329">
    
    55
    +              <object class="GtkImage">
    
    59 56
                     <property name="visible">True</property>
    
    60 57
                     <property name="can_focus">False</property>
    
    61
    -                <property name="stock">gtk-close</property>
    
    58
    +                <property name="icon_name">window-close</property>
    
    62 59
                     <property name="icon_size">1</property>
    
    63 60
                   </object>
    
    64 61
                 </child>
    
    ... ... @@ -78,9 +75,6 @@
    78 75
         <property name="default_width">480</property>
    
    79 76
         <property name="default_height">440</property>
    
    80 77
         <property name="show_menubar">False</property>
    
    81
    -    <child type="titlebar">
    
    82
    -      <placeholder/>
    
    83
    -    </child>
    
    84 78
         <child>
    
    85 79
           <object class="GtkNotebook" id="notebook">
    
    86 80
             <property name="visible">True</property>
    
    ... ... @@ -88,5 +82,8 @@
    88 82
             <property name="scrollable">True</property>
    
    89 83
           </object>
    
    90 84
         </child>
    
    85
    +    <child type="titlebar">
    
    86
    +      <placeholder/>
    
    87
    +    </child>
    
    91 88
       </object>
    
    92 89
     </interface>

  • gajim/data/gui/preferences_window.ui
    ... ... @@ -585,7 +585,7 @@
    585 585
                                 <property name="label" translatable="yes">Enable auto copy</property>
    
    586 586
                                 <property name="can_focus">True</property>
    
    587 587
                                 <property name="receives_default">False</property>
    
    588
    -                            <property name="tooltip_text" translatable="yes">If enabled, selecting Text will be copied to the clipboard, otherwise you can copy text with CTRL + SHIFT + C</property>
    
    588
    +                            <property name="tooltip_text" translatable="yes">If enabled, selected text will automatically be copied to the clipboard, otherwise you can copy text with CTRL + SHIFT + C</property>
    
    589 589
                                 <property name="halign">start</property>
    
    590 590
                                 <property name="use_underline">True</property>
    
    591 591
                                 <property name="draw_indicator">True</property>
    

  • gajim/data/gui/subscription_request_window.ui
    1 1
     <?xml version="1.0" encoding="UTF-8"?>
    
    2
    -<!-- Generated with glade 3.22.1 -->
    
    2
    +<!-- Generated with glade 3.36.0 -->
    
    3 3
     <interface>
    
    4 4
       <requires lib="gtk+" version="3.20"/>
    
    5
    +  <object class="GtkPopoverMenu" id="deny_popover">
    
    6
    +    <property name="can_focus">False</property>
    
    7
    +    <child>
    
    8
    +      <object class="GtkBox">
    
    9
    +        <property name="visible">True</property>
    
    10
    +        <property name="can_focus">False</property>
    
    11
    +        <property name="border_width">6</property>
    
    12
    +        <property name="orientation">vertical</property>
    
    13
    +        <property name="spacing">6</property>
    
    14
    +        <child>
    
    15
    +          <object class="GtkModelButton" id="deny_button">
    
    16
    +            <property name="visible">True</property>
    
    17
    +            <property name="can_focus">True</property>
    
    18
    +            <property name="receives_default">True</property>
    
    19
    +            <property name="text" translatable="yes">_Deny</property>
    
    20
    +            <signal name="clicked" handler="_on_deny_clicked" swapped="no"/>
    
    21
    +          </object>
    
    22
    +          <packing>
    
    23
    +            <property name="expand">False</property>
    
    24
    +            <property name="fill">True</property>
    
    25
    +            <property name="position">0</property>
    
    26
    +          </packing>
    
    27
    +        </child>
    
    28
    +        <child>
    
    29
    +          <object class="GtkModelButton" id="block_button">
    
    30
    +            <property name="visible">True</property>
    
    31
    +            <property name="sensitive">False</property>
    
    32
    +            <property name="can_focus">True</property>
    
    33
    +            <property name="receives_default">True</property>
    
    34
    +            <property name="text" translatable="yes">_Block User</property>
    
    35
    +            <signal name="clicked" handler="_on_block_clicked" swapped="no"/>
    
    36
    +          </object>
    
    37
    +          <packing>
    
    38
    +            <property name="expand">False</property>
    
    39
    +            <property name="fill">True</property>
    
    40
    +            <property name="position">1</property>
    
    41
    +          </packing>
    
    42
    +        </child>
    
    43
    +        <child>
    
    44
    +          <object class="GtkModelButton" id="report_button">
    
    45
    +            <property name="visible">True</property>
    
    46
    +            <property name="sensitive">False</property>
    
    47
    +            <property name="can_focus">True</property>
    
    48
    +            <property name="receives_default">True</property>
    
    49
    +            <property name="text" translatable="yes">_Report as Spam</property>
    
    50
    +            <signal name="clicked" handler="_on_report_clicked" swapped="no"/>
    
    51
    +          </object>
    
    52
    +          <packing>
    
    53
    +            <property name="expand">False</property>
    
    54
    +            <property name="fill">True</property>
    
    55
    +            <property name="position">2</property>
    
    56
    +          </packing>
    
    57
    +        </child>
    
    58
    +      </object>
    
    59
    +      <packing>
    
    60
    +        <property name="submenu">main</property>
    
    61
    +        <property name="position">1</property>
    
    62
    +      </packing>
    
    63
    +    </child>
    
    64
    +  </object>
    
    5 65
       <object class="GtkImage" id="image1">
    
    6 66
         <property name="visible">True</property>
    
    7 67
         <property name="can_focus">False</property>
    
    ... ... @@ -26,22 +86,20 @@
    26 86
             <property name="row_spacing">6</property>
    
    27 87
             <property name="column_spacing">12</property>
    
    28 88
             <child>
    
    29
    -          <object class="GtkLabel" id="jid_label">
    
    89
    +          <object class="GtkLabel">
    
    30 90
                 <property name="visible">True</property>
    
    31 91
                 <property name="can_focus">False</property>
    
    32
    -            <property name="halign">start</property>
    
    33
    -            <property name="label">&lt;XMPP address&gt;</property>
    
    92
    +            <property name="label">Subscription Request</property>
    
    34 93
                 <property name="wrap">True</property>
    
    35 94
                 <property name="wrap_mode">word-char</property>
    
    36
    -            <property name="max_width_chars">50</property>
    
    37
    -            <property name="xalign">0</property>
    
    38 95
                 <style>
    
    39 96
                   <class name="large-header"/>
    
    40 97
                 </style>
    
    41 98
               </object>
    
    42 99
               <packing>
    
    43
    -            <property name="left_attach">1</property>
    
    100
    +            <property name="left_attach">0</property>
    
    44 101
                 <property name="top_attach">0</property>
    
    102
    +            <property name="width">2</property>
    
    45 103
               </packing>
    
    46 104
             </child>
    
    47 105
             <child>
    
    ... ... @@ -84,38 +142,35 @@
    84 142
               </packing>
    
    85 143
             </child>
    
    86 144
             <child>
    
    87
    -          <object class="GtkButton" id="contact_info_button">
    
    145
    +          <object class="GtkButton" id="start_chat_button">
    
    88 146
                 <property name="visible">True</property>
    
    89 147
                 <property name="can_focus">True</property>
    
    90
    -            <property name="receives_default">True</property>
    
    91
    -            <property name="tooltip_text" translatable="yes">Contact Information</property>
    
    148
    +            <property name="receives_default">False</property>
    
    149
    +            <property name="tooltip_text" translatable="yes">Start Chat</property>
    
    92 150
                 <property name="valign">center</property>
    
    93
    -            <property name="image">image2</property>
    
    94
    -            <signal name="clicked" handler="_on_contact_info_clicked" swapped="no"/>
    
    151
    +            <property name="image">image1</property>
    
    152
    +            <signal name="clicked" handler="_on_start_chat_clicked" swapped="no"/>
    
    95 153
               </object>
    
    96 154
               <packing>
    
    97 155
                 <property name="left_attach">0</property>
    
    98
    -            <property name="top_attach">0</property>
    
    156
    +            <property name="top_attach">2</property>
    
    99 157
               </packing>
    
    100 158
             </child>
    
    101 159
             <child>
    
    102
    -          <object class="GtkButton" id="start_chat_button">
    
    160
    +          <object class="GtkButton" id="contact_info_button">
    
    103 161
                 <property name="visible">True</property>
    
    104 162
                 <property name="can_focus">True</property>
    
    105
    -            <property name="receives_default">True</property>
    
    106
    -            <property name="tooltip_text" translatable="yes">Start Chat</property>
    
    163
    +            <property name="receives_default">False</property>
    
    164
    +            <property name="tooltip_text" translatable="yes">Contact Information</property>
    
    107 165
                 <property name="valign">center</property>
    
    108
    -            <property name="image">image1</property>
    
    109
    -            <signal name="clicked" handler="_on_start_chat_clicked" swapped="no"/>
    
    166
    +            <property name="image">image2</property>
    
    167
    +            <signal name="clicked" handler="_on_contact_info_clicked" swapped="no"/>
    
    110 168
               </object>
    
    111 169
               <packing>
    
    112 170
                 <property name="left_attach">0</property>
    
    113
    -            <property name="top_attach">2</property>
    
    171
    +            <property name="top_attach">1</property>
    
    114 172
               </packing>
    
    115 173
             </child>
    
    116
    -        <child>
    
    117
    -          <placeholder/>
    
    118
    -        </child>
    
    119 174
           </object>
    
    120 175
           <packing>
    
    121 176
             <property name="expand">False</property>
    
    ... ... @@ -144,15 +199,20 @@
    144 199
             <property name="spacing">12</property>
    
    145 200
             <property name="homogeneous">True</property>
    
    146 201
             <child>
    
    147
    -          <object class="GtkButton" id="deny_button">
    
    148
    -            <property name="label" translatable="yes">_Deny</property>
    
    202
    +          <object class="GtkMenuButton">
    
    149 203
                 <property name="visible">True</property>
    
    150 204
                 <property name="can_focus">True</property>
    
    151
    -            <property name="can_default">True</property>
    
    152
    -            <property name="receives_default">False</property>
    
    153
    -            <property name="tooltip_text" translatable="yes">Deny authorization from contact so the contact cannot know if you are connected</property>
    
    154
    -            <property name="use_underline">True</property>
    
    155
    -            <signal name="clicked" handler="_on_deny_clicked" swapped="no"/>
    
    205
    +            <property name="focus_on_click">False</property>
    
    206
    +            <property name="receives_default">True</property>
    
    207
    +            <property name="popover">deny_popover</property>
    
    208
    +            <child>
    
    209
    +              <object class="GtkLabel">
    
    210
    +                <property name="visible">True</property>
    
    211
    +                <property name="can_focus">False</property>
    
    212
    +                <property name="label" translatable="yes">_Deny…</property>
    
    213
    +                <property name="use_underline">True</property>
    
    214
    +              </object>
    
    215
    +            </child>
    
    156 216
               </object>
    
    157 217
               <packing>
    
    158 218
                 <property name="expand">False</property>
    
    ... ... @@ -166,9 +226,8 @@
    166 226
                 <property name="visible">True</property>
    
    167 227
                 <property name="can_focus">True</property>
    
    168 228
                 <property name="can_default">True</property>
    
    169
    -            <property name="has_default">True</property>
    
    170
    -            <property name="receives_default">False</property>
    
    171
    -            <property name="tooltip_text" translatable="yes">Authorize contact so the contact can know if you are connected</property>
    
    229
    +            <property name="receives_default">True</property>
    
    230
    +            <property name="tooltip_text" translatable="yes">Allows the contact to see your online status</property>
    
    172 231
                 <property name="use_underline">True</property>
    
    173 232
                 <signal name="clicked" handler="_on_authorize_clicked" swapped="no"/>
    
    174 233
                 <style>
    
    ... ... @@ -178,7 +237,7 @@
    178 237
               <packing>
    
    179 238
                 <property name="expand">False</property>
    
    180 239
                 <property name="fill">True</property>
    
    181
    -            <property name="position">1</property>
    
    240
    +            <property name="position">2</property>
    
    182 241
               </packing>
    
    183 242
             </child>
    
    184 243
           </object>
    

  • gajim/gtk/mam_preferences.py
    ... ... @@ -78,10 +78,10 @@ class MamPreferences(Gtk.ApplicationWindow, EventHelper):
    78 78
             self._ui.default_combo.set_active_id(result.default)
    
    79 79
             self._ui.preferences_store.clear()
    
    80 80
             for jid in result.always:
    
    81
    -            self._ui.preferences_store.append((str(jid), 'Always'))
    
    81
    +            self._ui.preferences_store.append((str(jid), True))
    
    82 82
     
    
    83 83
             for jid in result.never:
    
    84
    -            self._ui.preferences_store.append((str(jid), 'Never'))
    
    84
    +            self._ui.preferences_store.append((str(jid), False))
    
    85 85
     
    
    86 86
         @ensure_not_destroyed
    
    87 87
         def _mam_prefs_saved(self, result):
    
    ... ... @@ -137,8 +137,8 @@ class MamPreferences(Gtk.ApplicationWindow, EventHelper):
    137 137
             never = []
    
    138 138
             default = self._ui.default_combo.get_active_id()
    
    139 139
             for item in self._ui.preferences_store:
    
    140
    -            jid, type_ = item
    
    141
    -            if type_ == 'Always':
    
    140
    +            jid, archive = item
    
    141
    +            if archive:
    
    142 142
                     always.append(jid)
    
    143 143
                 else:
    
    144 144
                     never.append(jid)
    

  • gajim/gtk/ssl_error_dialog.py
    ... ... @@ -80,4 +80,4 @@ class SSLErrorDialog(Gtk.ApplicationWindow):
    80 80
                 app.cert_store.add_certificate(self._cert)
    
    81 81
     
    
    82 82
             self.destroy()
    
    83
    -        self._con.process_ssl_errors()
    83
    +        self._con.process_tls_errors()

  • gajim/gtk/subscription_request.py
    ... ... @@ -13,6 +13,7 @@
    13 13
     # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
    
    14 14
     
    
    15 15
     from gi.repository import Gtk
    
    16
    +from gi.repository import Gdk
    
    16 17
     
    
    17 18
     from gajim import vcard
    
    18 19
     
    
    ... ... @@ -33,25 +34,38 @@ class SubscriptionRequest(Gtk.ApplicationWindow):
    33 34
             self.set_position(Gtk.WindowPosition.CENTER)
    
    34 35
             self.set_title(_('Subscription Request'))
    
    35 36
     
    
    36
    -        self._ui = get_builder('subscription_request_window.ui')
    
    37
    -        self.add(self._ui.subscription_box)
    
    38 37
             self.jid = jid
    
    39 38
             self.account = account
    
    40 39
             self.user_nick = user_nick
    
    41
    -        self._ui.jid_label.set_text(self.jid)
    
    40
    +
    
    41
    +        self._ui = get_builder('subscription_request_window.ui')
    
    42
    +        self.add(self._ui.subscription_box)
    
    43
    +        self._ui.authorize_button.grab_default()
    
    44
    +
    
    42 45
             if len(app.connections) >= 2:
    
    43
    -            prompt_text = \
    
    44
    -                _('Subscription request for account %(account)s from %(jid)s')\
    
    45
    -                % {'account': account, 'jid': self.jid}
    
    46
    +            prompt_text = _(
    
    47
    +                'Subscription request for account %(account)s from '
    
    48
    +                '%(jid)s') % {'account': self.account, 'jid': self.jid}
    
    46 49
             else:
    
    47 50
                 prompt_text = _('Subscription request from %s') % self.jid
    
    48 51
     
    
    49 52
             self._ui.request_label.set_text(prompt_text)
    
    50 53
             self._ui.subscription_text.set_text(text)
    
    51 54
     
    
    55
    +        con = app.connections[self.account]
    
    56
    +        if con.get_module('Blocking').supported:
    
    57
    +            self._ui.block_button.set_sensitive(True)
    
    58
    +            self._ui.report_button.set_sensitive(True)
    
    59
    +
    
    60
    +        self.connect('key-press-event', self._on_key_press)
    
    61
    +
    
    52 62
             self._ui.connect_signals(self)
    
    53 63
             self.show_all()
    
    54 64
     
    
    65
    +    def _on_key_press(self, _widget, event):
    
    66
    +        if event.keyval == Gdk.KEY_Escape:
    
    67
    +            self.destroy()
    
    68
    +
    
    55 69
         def _on_authorize_clicked(self, _widget):
    
    56 70
             """
    
    57 71
             Accept the request
    
    ... ... @@ -86,12 +100,28 @@ class SubscriptionRequest(Gtk.ApplicationWindow):
    86 100
             app.interface.new_chat_from_jid(self.account, self.jid)
    
    87 101
     
    
    88 102
         def _on_deny_clicked(self, _widget):
    
    89
    -        """
    
    90
    -        Refuse the request
    
    91
    -        """
    
    103
    +        self._deny_request()
    
    104
    +        self._remove_contact()
    
    105
    +
    
    106
    +    def _on_block_clicked(self, _widget):
    
    107
    +        self._deny_request()
    
    108
    +        con = app.connections[self.account]
    
    109
    +        con.get_module('Blocking').block([self.jid])
    
    110
    +        self._remove_contact()
    
    111
    +
    
    112
    +    def _on_report_clicked(self, _widget):
    
    113
    +        self._deny_request()
    
    114
    +        con = app.connections[self.account]
    
    115
    +        con.get_module('Blocking').block([self.jid], report='spam')
    
    116
    +        self._remove_contact()
    
    117
    +
    
    118
    +    def _deny_request(self):
    
    92 119
             con = app.connections[self.account]
    
    93 120
             con.get_module('Presence').unsubscribed(self.jid)
    
    121
    +
    
    122
    +    def _remove_contact(self):
    
    94 123
             contact = app.contacts.get_contact(self.account, self.jid)
    
    95 124
             if contact and _('Not in contact list') in contact.get_shown_groups():
    
    96
    -            app.interface.roster.remove_contact(self.jid, self.account)
    
    125
    +            app.interface.roster.remove_contact(
    
    126
    +                self.jid, self.account, force=True, backend=True)
    
    97 127
             self.destroy()

  • gajim/gtk/tooltips.py
    ... ... @@ -91,8 +91,7 @@ class StatusTable:
    91 91
                               1)
    
    92 92
             self.current_row += 1
    
    93 93
     
    
    94
    -    def add_status_row(self, show, str_status, show_lock=False,
    
    95
    -                       indent=True, transport=None):
    
    94
    +    def add_status_row(self, show, str_status, indent=True, transport=None):
    
    96 95
             """
    
    97 96
             Append a new row with status icon to the table
    
    98 97
             """
    
    ... ... @@ -117,10 +116,6 @@ class StatusTable:
    117 116
             status_label.set_ellipsize(Pango.EllipsizeMode.END)
    
    118 117
             status_label.set_max_width_chars(30)
    
    119 118
             self.table.attach(status_label, 3, self.current_row, 1, 1)
    
    120
    -        if show_lock:
    
    121
    -            lock_image = Gtk.Image()
    
    122
    -            lock_image.set_from_icon_name('dialog-password', Gtk.IconSize.MENU)
    
    123
    -            self.table.attach(lock_image, 4, self.current_row, 1, 1)
    
    124 119
             self.current_row += 1
    
    125 120
     
    
    126 121
         def fill_table_with_accounts(self, accounts):
    
    ... ... @@ -128,8 +123,6 @@ class StatusTable:
    128 123
                 message = acct['message']
    
    129 124
                 message = helpers.reduce_chars_newlines(message, 100, 1)
    
    130 125
                 message = GLib.markup_escape_text(message)
    
    131
    -            con_type = app.con_types.get(acct['name'])
    
    132
    -            show_lock = con_type in ('tls', 'ssl')
    
    133 126
     
    
    134 127
                 account_label = GLib.markup_escape_text(acct['account_label'])
    
    135 128
                 if message:
    
    ... ... @@ -137,10 +130,7 @@ class StatusTable:
    137 130
                 else:
    
    138 131
                     status = account_label
    
    139 132
     
    
    140
    -            self.add_status_row(acct['show'],
    
    141
    -                                status,
    
    142
    -                                show_lock=show_lock,
    
    143
    -                                indent=False)
    
    133
    +            self.add_status_row(acct['show'], status, indent=False)
    
    144 134
     
    
    145 135
                 for line in acct['event_lines']:
    
    146 136
                     self.add_text_row('  ' + line, 1)
    

  • gajim/gui_interface.py
    ... ... @@ -1521,7 +1521,6 @@ class Interface:
    1521 1521
                 '%s@%s' % (username, domain))
    
    1522 1522
             config['hostname'] = domain
    
    1523 1523
             config['savepass'] = True
    
    1524
    -        config['password'] = password
    
    1525 1524
             config['anonymous_auth'] = anonymous
    
    1526 1525
             config['autoconnect'] = True
    
    1527 1526
             config['sync_with_global_status'] = True
    
    ... ... @@ -1542,10 +1541,14 @@ class Interface:
    1542 1541
             for opt in config:
    
    1543 1542
                 app.config.set_per('accounts', account, opt, config[opt])
    
    1544 1543
     
    
    1544
    +        # Password module depends on existing config
    
    1545
    +        passwords.save_password(account, password)
    
    1546
    +
    
    1545 1547
             app.css_config.refresh()
    
    1546
    -        # refresh accounts window
    
    1548
    +
    
    1547 1549
             # Action must be added before account window is updated
    
    1548 1550
             app.app.add_account_actions(account)
    
    1551
    +
    
    1549 1552
             window = get_app_window('AccountsWindow')
    
    1550 1553
             if window is not None:
    
    1551 1554
                 window.add_account(account)
    

  • gajim/gui_menu_builder.py
    ... ... @@ -397,7 +397,7 @@ control=None, gc_contact=None, is_anonymous=True):
    397 397
             if helpers.jid_is_blocked(account, jid):
    
    398 398
                 block_menuitem.set_no_show_all(True)
    
    399 399
                 block_menuitem.hide()
    
    400
    -            if transport != 'jabber':
    
    400
    +            if transport not in ('jabber', None):
    
    401 401
                     unblock_menuitem.set_no_show_all(True)
    
    402 402
                     unblock_menuitem.hide()
    
    403 403
                     unignore_menuitem.set_no_show_all(False)
    
    ... ... @@ -409,7 +409,7 @@ control=None, gc_contact=None, is_anonymous=True):
    409 409
             else:
    
    410 410
                 unblock_menuitem.set_no_show_all(True)
    
    411 411
                 unblock_menuitem.hide()
    
    412
    -            if transport != 'jabber':
    
    412
    +            if transport not in ('jabber', None):
    
    413 413
                     block_menuitem.set_no_show_all(True)
    
    414 414
                     block_menuitem.hide()
    
    415 415
                     ignore_menuitem.set_no_show_all(False)
    

  • gajim/roster_window.py
    ... ... @@ -290,13 +290,9 @@ class RosterWindow:
    290 290
                 show = helpers.get_connection_status(account)
    
    291 291
                 our_jid = app.get_jid_from_account(account)
    
    292 292
     
    
    293
    -            tls_pixbuf = None
    
    294
    -            if app.account_is_securely_connected(account):
    
    295
    -                tls_pixbuf = 'changes-prevent'
    
    296
    -
    
    297 293
                 it = self.model.append(None, [get_icon_name(show),
    
    298 294
                     GLib.markup_escape_text(account), 'account', our_jid,
    
    299
    -                account, None, None, None, None, None, tls_pixbuf, True] +
    
    295
    +                account, None, None, None, None, None, None, True] +
    
    300 296
                     [None] * self.nb_ext_renderers)
    
    301 297
                 self._iters[account]['account'] = it
    
    302 298
     
    
    ... ... @@ -1009,15 +1005,6 @@ class RosterWindow:
    1009 1005
             if not child_iter:
    
    1010 1006
                 return
    
    1011 1007
     
    
    1012
    -        num_of_accounts = app.get_number_of_connected_accounts()
    
    1013
    -        num_of_secured = app.get_number_of_securely_connected_accounts()
    
    1014
    -
    
    1015
    -        tls_pixbuf = None
    
    1016
    -        if app.account_is_securely_connected(account) and not self.regroup or\
    
    1017
    -        self.regroup and num_of_secured and num_of_secured == num_of_accounts:
    
    1018
    -            tls_pixbuf = 'changes-prevent'
    
    1019
    -            self.model[child_iter][Column.PADLOCK_PIXBUF] = tls_pixbuf
    
    1020
    -
    
    1021 1008
             if self.regroup:
    
    1022 1009
                 account_name = _('Merged accounts')
    
    1023 1010
                 accounts = []
    
    ... ... @@ -2188,8 +2175,6 @@ class RosterWindow:
    2188 2175
                     # No need to redraw contacts if we're quitting
    
    2189 2176
                     if child_iterA:
    
    2190 2177
                         self.model[child_iterA][Column.AVATAR_IMG] = None
    
    2191
    -                if account in app.con_types:
    
    2192
    -                    app.con_types[account] = None
    
    2193 2178
                     for jid in list(app.contacts.get_jid_list(account)):
    
    2194 2179
                         lcontact = app.contacts.get_contacts(account, jid)
    
    2195 2180
                         ctrl = app.interface.msg_win_mgr.get_gc_control(jid,