diff options
author | wurstsalat <mailtrash@posteo.de> | 2022-06-01 22:57:53 +0300 |
---|---|---|
committer | wurstsalat <mailtrash@posteo.de> | 2022-06-01 22:57:58 +0300 |
commit | 1932b2d012cdb3dcddd87ae7609a821c70ef880d (patch) | |
tree | 326081f6c20082b36e888defd70739f99b35f488 | |
parent | 2533d2ea60b13f39d49a9aae1ff58a793608c165 (diff) |
[anti_spam] 1.6.5
Fixes #598
-rw-r--r-- | anti_spam/config_dialog.py | 15 | ||||
-rw-r--r-- | anti_spam/plugin-manifest.json | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/anti_spam/config_dialog.py b/anti_spam/config_dialog.py index 936a140..2e31d70 100644 --- a/anti_spam/config_dialog.py +++ b/anti_spam/config_dialog.py @@ -13,6 +13,11 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see <http://www.gnu.org/licenses/>. +from __future__ import annotations + +from typing import Any +from typing import cast + from gi.repository import Gtk from gajim.gui.settings import SettingsDialog @@ -26,14 +31,14 @@ from gajim.plugins.plugins_i18n import _ class AntiSpamConfigDialog(SettingsDialog): def __init__(self, plugin, parent): self.plugin = plugin - msgtxt_limit = self.plugin.config['msgtxt_limit'] + msgtxt_limit = cast(int, self.plugin.config['msgtxt_limit']) max_length = '' if msgtxt_limit == 0 else msgtxt_limit settings = [ Setting(SettingKind.ENTRY, _('Limit Message Length'), SettingType.VALUE, - max_length, + str(max_length), callback=self._on_length_setting, data='msgtxt_limit', desc=_('Limits maximum message length (leave empty to ' @@ -89,11 +94,11 @@ class AntiSpamConfigDialog(SettingsDialog): SettingsDialog.__init__(self, parent, _('Anti Spam Configuration'), Gtk.DialogFlags.MODAL, settings, None) - def _on_setting(self, value, data): + def _on_setting(self, value: Any, data: Any) -> None: self.plugin.config[data] = value - def _on_length_setting(self, value, data): + def _on_length_setting(self, value: str, data: str) -> None: try: self.plugin.config[data] = int(value) - except Exception: + except ValueError: self.plugin.config[data] = 0 diff --git a/anti_spam/plugin-manifest.json b/anti_spam/plugin-manifest.json index 1bd3041..646acd2 100644 --- a/anti_spam/plugin-manifest.json +++ b/anti_spam/plugin-manifest.json @@ -17,5 +17,5 @@ "gajim>=1.4.0" ], "short_name": "anti_spam", - "version": "1.6.4" + "version": "1.6.5" }
\ No newline at end of file |