Daniel Brötzmann pushed to branch master at gajim / gajim

Commits:

4 changed files:

Changes:

  • data/gajim-remote.1
    ... ... @@ -116,4 +116,3 @@ https://lists.gajim.org/cgi-bin/listinfo
    116 116
     Please submit bugs at https://dev.gajim.org/gajim/gajim/issues
    
    117 117
     .Sh SEE ALSO
    
    118 118
     .Xr gajim 1
    119
    -.Xr gajim-history-manager 1

  • data/gajim.1
    ... ... @@ -3,7 +3,7 @@
    3 3
     .Os UNIX
    
    4 4
     .Sh NAME
    
    5 5
     .Nm gajim
    
    6
    -.Nd a Jabber/XMPP client
    
    6
    +.Nd A fully-featured XMPP chat client
    
    7 7
     .Sh SYNOPSIS
    
    8 8
     .Nm
    
    9 9
     .Fl h
    
    ... ... @@ -17,18 +17,19 @@
    17 17
     .Op Fl c Ar directory
    
    18 18
     .Sh DESCRIPTION
    
    19 19
     .Nm
    
    20
    -is a Jabber/XMPP client written in Python and GTK+.
    
    20
    +aims to be an easy to use and fully-featured XMPP client.
    
    21
    +Just chat with your friends or family, easily share pictures and thoughts or
    
    22
    +discuss the news with your groups.
    
    23
    +Chat securely with End-to-End encryption via OMEMO or OpenPGP.
    
    21 24
     .Nm
    
    22
    -works nicely with GNOME, yet it does not require it to run.
    
    23
    -.Nm
    
    24
    -is designed for novice and advanced users as one, as well for XMPP
    
    25
    -server admins.
    
    25
    +integrates well with your other devices:
    
    26
    +simply continue conversations on your mobile device.
    
    26 27
     .Pp
    
    27 28
     XMPP is the Extensible Messaging and Presence Protocol, a set of open
    
    28 29
     technologies for instant messaging, presence, multi-party chat, voice
    
    29 30
     and video calls, collaboration, lightweight middleware, content
    
    30 31
     syndication, and generalized routing of XML data. For more information
    
    31
    -on the XMPP protocol see <https://xmpp.org/about-xmpp/>.
    
    32
    +on the XMPP protocol see <https://xmpp.org/about/>.
    
    32 33
     .Sh OPTIONS
    
    33 34
     .Bl -tag -width Ds
    
    34 35
     .It Fl h Fl Fl help
    
    ... ... @@ -44,10 +45,11 @@ Show all GTK warnings with traceback
    44 45
     .It Fl l Fl Fl loglevel Em subsystem=level Bq , Em subsystem=level Bq Em ...
    
    45 46
     Configure logging system.
    
    46 47
     Subsystem can be
    
    47
    -.Em gajim.interface ,
    
    48
    -.Em gajim.c.connection ,
    
    49
    -.Em .nbxmpp.client_nb ,
    
    48
    +.Em gajim.c.preview ,
    
    49
    +.Em gajim.gui.preview ,
    
    50
    +.Em .nbxmpp.stream ,
    
    50 51
     etc.
    
    52
    +.Pp
    
    51 53
     Level can be
    
    52 54
     .Em DEBUG ,
    
    53 55
     .Em INFO ,
    
    ... ... @@ -70,8 +72,6 @@ Where to look for configuration files
    70 72
     Cache database file of transports, caps, roster entry, and roster group.
    
    71 73
     .It $XDG_CACHE_HOME/gajim/avatars/
    
    72 74
     Cache directory of avatars.
    
    73
    -.It $XDG_CACHE_HOME/gajim/vcards/
    
    74
    -Cache directory of vCards (virtual cards).
    
    75 75
     .It $XDG_CONFIG_HOME/gajim/
    
    76 76
     The config-path used when
    
    77 77
     .Op Fl c
    
    ... ... @@ -130,9 +130,8 @@ https://lists.gajim.org/cgi-bin/listinfo
    130 130
     Please submit bugs at
    
    131 131
     .Bd -literal -offset indent
    
    132 132
     https://dev.gajim.org/gajim/gajim/issues
    
    133
    -https://dev.gajim.org/gajim/gajim-plugins
    
    134
    -https://dev.gajim.org/gajim/python-nbxmpp
    
    133
    +https://dev.gajim.org/gajim/gajim-plugins/issues
    
    134
    +https://dev.gajim.org/gajim/python-nbxmpp/issues
    
    135 135
     .Ed
    
    136 136
     .Sh SEE ALSO
    
    137 137
     .Xr gajim-remote 1
    138
    -.Xr gajim-history-manager 1

  • gajim/common/helpers.py
    ... ... @@ -29,10 +29,7 @@
    29 29
     
    
    30 30
     from typing import Any
    
    31 31
     from typing import Callable
    
    32
    -from typing import Dict
    
    33 32
     from typing import Optional
    
    34
    -from typing import List
    
    35
    -from typing import Tuple
    
    36 33
     from typing import Union
    
    37 34
     
    
    38 35
     import sys
    
    ... ... @@ -74,10 +71,14 @@
    74 71
     from nbxmpp.structs import ProxyData
    
    75 72
     from nbxmpp.protocol import JID
    
    76 73
     from nbxmpp.protocol import InvalidJid
    
    74
    +from nbxmpp.protocol import Iq
    
    75
    +
    
    77 76
     from OpenSSL.crypto import X509, load_certificate
    
    78 77
     from OpenSSL.crypto import FILETYPE_PEM
    
    78
    +
    
    79 79
     from gi.repository import Gio
    
    80 80
     from gi.repository import GLib
    
    81
    +
    
    81 82
     import precis_i18n.codec  # pylint: disable=unused-import
    
    82 83
     
    
    83 84
     from gajim.common import app
    
    ... ... @@ -318,8 +319,8 @@ def get_uf_relative_time(timestamp: float) -> str:
    318 319
             return ngettext('%i min ago',
    
    319 320
                             '%i mins ago',
    
    320 321
                             minutes,
    
    321
    -                        minutes,
    
    322
    -                        minutes)
    
    322
    +                        str(minutes),
    
    323
    +                        str(minutes))
    
    323 324
         return _('Just now')
    
    324 325
     
    
    325 326
     def get_sorted_keys(adict):
    
    ... ... @@ -478,7 +479,9 @@ def play_sound(sound_event: str,
    478 479
                 app.settings.get_soundevent_settings(sound_event)['path'], loop)
    
    479 480
     
    
    480 481
     
    
    481
    -def check_soundfile_path(file_, dirs=None):
    
    482
    +def check_soundfile_path(file_: str,
    
    483
    +                         dirs: Optional[list[Path]] = None
    
    484
    +                         ) -> Optional[Path]:
    
    482 485
         """
    
    483 486
         Check if the sound file exists
    
    484 487
     
    
    ... ... @@ -532,8 +535,8 @@ def strip_soundfile_path(file_, dirs=None, abs_=True):
    532 535
                 return name
    
    533 536
         return file_
    
    534 537
     
    
    535
    -def play_sound_file(path_to_soundfile: str, loop: bool = False) -> None:
    
    536
    -    path_to_soundfile = check_soundfile_path(path_to_soundfile)
    
    538
    +def play_sound_file(str_path_to_soundfile: str, loop: bool = False) -> None:
    
    539
    +    path_to_soundfile = check_soundfile_path(str_path_to_soundfile)
    
    537 540
         if path_to_soundfile is None:
    
    538 541
             return
    
    539 542
     
    
    ... ... @@ -595,7 +598,7 @@ def statuses_unified() -> bool:
    595 598
         return True
    
    596 599
     
    
    597 600
     
    
    598
    -def get_full_jid_from_iq(iq_obj):
    
    601
    +def get_full_jid_from_iq(iq_obj: Iq) -> Optional[str]:
    
    599 602
         """
    
    600 603
         Return the full jid (with resource) from an iq
    
    601 604
         """
    
    ... ... @@ -604,11 +607,13 @@ def get_full_jid_from_iq(iq_obj):
    604 607
             return None
    
    605 608
         return parse_jid(str(iq_obj.getFrom()))
    
    606 609
     
    
    607
    -def get_jid_from_iq(iq_obj):
    
    610
    +def get_jid_from_iq(iq_obj: Iq) -> Optional[str]:
    
    608 611
         """
    
    609 612
         Return the jid (without resource) from an iq
    
    610 613
         """
    
    611 614
         jid = get_full_jid_from_iq(iq_obj)
    
    615
    +    if jid is None:
    
    616
    +        return None
    
    612 617
         return app.get_jid_without_resource(jid)
    
    613 618
     
    
    614 619
     def get_auth_sha(sid: str, initiator: str, target: str) -> str:
    
    ... ... @@ -697,8 +702,8 @@ def allow_sound_notification(account: str, sound_event: str) -> bool:
    697 702
         return False
    
    698 703
     
    
    699 704
     
    
    700
    -def get_optional_features(account: str) -> List[Namespace]:
    
    701
    -    features = []
    
    705
    +def get_optional_features(account: str) -> list[Namespace]:
    
    706
    +    features: list[str] = []
    
    702 707
     
    
    703 708
         if app.settings.get_account_setting(account, 'request_user_data'):
    
    704 709
             features.append(Namespace.TUNE + '+notify')
    
    ... ... @@ -764,7 +769,7 @@ def get_proxy(proxy_name: str) -> Optional[ProxyData]:
    764 769
             username, password = settings['user'], settings['pass']
    
    765 770
     
    
    766 771
         return ProxyData(type=settings['type'],
    
    767
    -                     host='%s:%s' % (settings['host'], settings['port']),
    
    772
    +                     host=f"{settings['host']}:{settings['port']}",
    
    768 773
                          username=username,
    
    769 774
                          password=password)
    
    770 775
     
    
    ... ... @@ -773,8 +778,8 @@ def version_condition(current_version: str, required_version: str) -> bool:
    773 778
             return False
    
    774 779
         return True
    
    775 780
     
    
    776
    -def get_available_emoticon_themes() -> List[str]:
    
    777
    -    files = []
    
    781
    +def get_available_emoticon_themes() -> list[str]:
    
    782
    +    files: list[Path] = []
    
    778 783
         for folder in configpaths.get('EMOTICONS').iterdir():
    
    779 784
             if not folder.is_dir():
    
    780 785
                 continue
    
    ... ... @@ -879,8 +884,10 @@ def copy(self) -> AdditionalDataDict:
    879 884
     
    
    880 885
     
    
    881 886
     class Singleton(type):
    
    882
    -    _instances = {}  # type: Dict[Any, Any]
    
    883
    -    def __call__(cls, *args, **kwargs):
    
    887
    +
    
    888
    +    _instances: dict[Any, Any] = {}
    
    889
    +
    
    890
    +    def __call__(cls, *args: Any, **kwargs: Any):
    
    884 891
             if cls not in cls._instances:
    
    885 892
                 cls._instances[cls] = super(Singleton, cls).__call__(
    
    886 893
                     *args, **kwargs)
    
    ... ... @@ -938,7 +945,7 @@ def func_wrapper(self, *args, **kwargs):
    938 945
         return func_wrapper
    
    939 946
     
    
    940 947
     
    
    941
    -def parse_uri_actions(uri: str) -> Tuple[str, Dict[str, str]]:
    
    948
    +def parse_uri_actions(uri: str) -> tuple[str, dict[str, str]]:
    
    942 949
         uri = uri[5:]
    
    943 950
         if '?' not in uri:
    
    944 951
             return 'message', {'jid': uri}
    
    ... ... @@ -1065,7 +1072,7 @@ def open_file(path: Union[str, Path]) -> None:
    1065 1072
             Gio.AppInfo.launch_default_for_uri(path)
    
    1066 1073
     
    
    1067 1074
     
    
    1068
    -def file_is_locked(path_to_file):
    
    1075
    +def file_is_locked(path_to_file: str) -> bool:
    
    1069 1076
         """
    
    1070 1077
         Return True if file is locked
    
    1071 1078
         NOTE: Windows only.
    
    ... ... @@ -1112,7 +1119,7 @@ def get_resource(account: str) -> Optional[str]:
    1112 1119
         return resource
    
    1113 1120
     
    
    1114 1121
     
    
    1115
    -def get_default_muc_config() -> Dict[str, Union[bool, str]]:
    
    1122
    +def get_default_muc_config() -> dict[str, Union[bool, str]]:
    
    1116 1123
         return {
    
    1117 1124
             # XEP-0045 options
    
    1118 1125
             'muc#roomconfig_allowinvites': True,
    
    ... ... @@ -1147,7 +1154,7 @@ def validate_jid(jid: Union[str, JID], type_: Optional[str] = None) -> JID:
    1147 1154
         if type_ == 'domain' and jid.is_domain:
    
    1148 1155
             return jid
    
    1149 1156
     
    
    1150
    -    raise ValueError('Not a %s JID' % type_)
    
    1157
    +    raise ValueError(f'Not a {type_} JID')
    
    1151 1158
     
    
    1152 1159
     
    
    1153 1160
     def to_user_string(error: StanzaError) -> str:
    
    ... ... @@ -1161,7 +1168,7 @@ def to_user_string(error: StanzaError) -> str:
    1161 1168
         return condition
    
    1162 1169
     
    
    1163 1170
     
    
    1164
    -def get_groupchat_name(client: types.Client, jid: Union[str, JID]) -> str:
    
    1171
    +def get_groupchat_name(client: types.Client, jid: JID) -> str:
    
    1165 1172
         name = client.get_module('Bookmarks').get_name_from_bookmark(jid)
    
    1166 1173
         if name:
    
    1167 1174
             return name
    
    ... ... @@ -1336,7 +1343,7 @@ def convert_gio_to_openssl_cert(cert: Gio.TlsCertificate) -> X509:
    1336 1343
         return load_certificate(FILETYPE_PEM, cert.props.certificate_pem.encode())
    
    1337 1344
     
    
    1338 1345
     
    
    1339
    -def get_custom_host(account: str) -> Optional[Tuple[str,
    
    1346
    +def get_custom_host(account: str) -> Optional[tuple[str,
    
    1340 1347
                                                         ConnectionProtocol,
    
    1341 1348
                                                         ConnectionType]]:
    
    1342 1349
         if not app.settings.get_account_setting(account, 'use_custom_host'):
    
    ... ... @@ -1355,7 +1362,7 @@ def get_custom_host(account: str) -> Optional[Tuple[str,
    1355 1362
     
    
    1356 1363
     
    
    1357 1364
     def warn_about_plain_connection(account: str,
    
    1358
    -                                connection_types: List[ConnectionType]
    
    1365
    +                                connection_types: list[ConnectionType]
    
    1359 1366
                                     ) -> bool:
    
    1360 1367
         warn = app.settings.get_account_setting(
    
    1361 1368
             account, 'confirm_unencrypted_connection')
    

  • gajim/gtk/chat_list.py
    ... ... @@ -756,7 +756,7 @@ def update_avatar(self) -> None:
    756 756
         def update_name(self) -> None:
    
    757 757
             if self.type == 'pm':
    
    758 758
                 client = app.get_client(self.account)
    
    759
    -            muc_name = get_groupchat_name(client, self.jid.bare)
    
    759
    +            muc_name = get_groupchat_name(client, self.jid.new_as_bare())
    
    760 760
                 self._ui.name_label.set_text(f'{self.contact.name} ({muc_name})')
    
    761 761
                 return
    
    762 762