Philipp Hörist pushed to branch master at gajim / gajim
Commits:
4aae9dc4 by Philipp Hörist at 2025-12-20T19:45:48+01:00
fix: HTTPUpload: Fix file transfer only available after chat switch
When a chat was selected before the http upload feature was discovered
the action was not updated.
- - - - -
2 changed files:
- gajim/common/modules/httpupload.py
- gajim/gtk/chat_stack.py
Changes:
=====================================
gajim/common/modules/httpupload.py
=====================================
@@ -27,6 +27,7 @@
from gajim.common import types
from gajim.common.aes import AESKeyData
from gajim.common.const import FTState
+from gajim.common.events import FeatureDiscovered
from gajim.common.events import HTTPUploadError
from gajim.common.events import HTTPUploadStarted
from gajim.common.exceptions import FileError
@@ -76,6 +77,10 @@ def pass_disco(self, info: DiscoInfo) -> None:
)
self._log.info("Component has a maximum file size of: %s", size)
+ app.ged.raise_event(
+ FeatureDiscovered(account=self._account,
feature=Namespace.HTTPUPLOAD_0)
+ )
+
def get_running_transfers(
self, contact: types.ChatContactT
) -> set[HTTPFileTransfer] | None:
=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -13,6 +13,7 @@
from gi.repository import GLib
from gi.repository import Gtk
from nbxmpp.errors import StanzaError
+from nbxmpp.namespaces import Namespace
from nbxmpp.protocol import JID
from nbxmpp.task import Task
@@ -139,6 +140,7 @@ def __init__(self):
("account-connected", 85, self._on_account_state),
("account-disconnected", 85, self._on_account_state),
("register-actions", ged.GUI1, self._on_register_actions),
+ ("feature-discovered", ged.GUI1, self._on_feature_discovered),
]
)
@@ -377,6 +379,16 @@ def _on_muc_disco_update(self, event:
events.MucDiscoUpdate) -> None:
self._update_group_chat_actions(self._current_contact)
+ def _on_feature_discovered(self, event: events.FeatureDiscovered) -> None:
+ if self._current_contact is None:
+ return
+
+ if event.account != self._current_contact.account:
+ return
+
+ if event.feature == Namespace.HTTPUPLOAD_0:
+ self._update_base_actions(self._current_contact)
+
def _on_account_state(
self, event: events.AccountConnected | events.AccountDisconnected
) -> None:
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/4aae9dc45ffdf91b20c344d793cb854d389e03df
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/4aae9dc45ffdf91b20c344d793cb854d389e03df
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]