Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2023-11-18 19:51:09 +0300
committerPhilipp Hörist <philipp@hoerist.com>2023-11-18 20:05:33 +0300
commit59f681ba7afeb89e2398aefde495a0f47988d966 (patch)
tree52f656ce1bf8f31a6f30a5f2acd31a9dfedc48f0
parentd5e8951bbf0a70cb05c0b4594092c83f493e1d55 (diff)
cq: Fixes
-rw-r--r--gajim/common/storage/archive/storage.py2
-rw-r--r--gajim/common/storage/archive/structs.py2
-rw-r--r--gajim/common/structs.py2
-rw-r--r--gajim/gtk/chat_list.py3
-rw-r--r--gajim/gtk/control.py4
-rw-r--r--gajim/gtk/conversation/view.py22
6 files changed, 28 insertions, 7 deletions
diff --git a/gajim/common/storage/archive/storage.py b/gajim/common/storage/archive/storage.py
index aee23936c..51155bc9e 100644
--- a/gajim/common/storage/archive/storage.py
+++ b/gajim/common/storage/archive/storage.py
@@ -97,7 +97,7 @@ def _row_factory(
def namedtuple_row(cursor: sqlite.Cursor, row: tuple[Any, ...]) -> Any:
- fields = [column[0] for column in cursor.description] # pyright: ignore
+ fields = [column[0] for column in cursor.description]
cls = namedtuple('Row', fields) # pyright: ignore
return cls._make(row)
diff --git a/gajim/common/storage/archive/structs.py b/gajim/common/storage/archive/structs.py
index 8eb5d6496..1509e52da 100644
--- a/gajim/common/storage/archive/structs.py
+++ b/gajim/common/storage/archive/structs.py
@@ -558,7 +558,7 @@ class DbBaseJoinedRowData:
def from_row(
cls,
column_names: list[str],
- row: tuple[Any]
+ row: tuple[Any, ...]
):
tkv: dict[str, Any] = {}
diff --git a/gajim/common/structs.py b/gajim/common/structs.py
index cf96e5f65..1996269ec 100644
--- a/gajim/common/structs.py
+++ b/gajim/common/structs.py
@@ -38,8 +38,8 @@ from gajim.common.const import KindConstant
from gajim.common.const import MUCJoinedState
from gajim.common.const import PresenceShowExt
from gajim.common.const import URIType
-from gajim.common.util.datetime import convert_epoch_to_local_datetime
from gajim.common.storage.archive.const import MessageType
+from gajim.common.util.datetime import convert_epoch_to_local_datetime
_T = TypeVar('_T')
diff --git a/gajim/gtk/chat_list.py b/gajim/gtk/chat_list.py
index f03678309..40ab3c733 100644
--- a/gajim/gtk/chat_list.py
+++ b/gajim/gtk/chat_list.py
@@ -609,6 +609,9 @@ class ChatList(Gtk.ListBox, EventHelper):
if joined_data.message is None:
return
+ assert joined_data.stanza_id is not None
+ assert joined_data.message_id is not None
+
nick = self._get_nick_for_received_message(event.account, joined_data)
row.set_nick(nick)
row.set_timestamp(joined_data.timestamp)
diff --git a/gajim/gtk/control.py b/gajim/gtk/control.py
index 45267049a..8c087fd81 100644
--- a/gajim/gtk/control.py
+++ b/gajim/gtk/control.py
@@ -512,9 +512,9 @@ class ChatControl(EventHelper):
def _request_messages(self, before: bool) -> list[DbConversationJoinedData]:
if before:
- row = self._scrolled_view.get_first_message_row()
+ row = self._scrolled_view.get_first_row()
else:
- row = self._scrolled_view.get_last_message_row()
+ row = self._scrolled_view.get_last_row()
if row is None:
timestamp = time.time()
diff --git a/gajim/gtk/conversation/view.py b/gajim/gtk/conversation/view.py
index 89808fa67..7ac04ce44 100644
--- a/gajim/gtk/conversation/view.py
+++ b/gajim/gtk/conversation/view.py
@@ -381,20 +381,38 @@ class ConversationView(Gtk.ScrolledWindow):
assert row is not None
return cast(BaseRow, row)
- def get_first_message_row(self
+ def get_first_row(self
) -> MessageRow | CallRow | FileTransferJingleRow | None:
for row in self._list_box.get_children():
if isinstance(row, MessageRow | CallRow | FileTransferJingleRow):
return row
return None
- def get_last_message_row(self) -> MessageRow | CallRow | FileTransferJingleRow | None:
+ def get_last_row(
+ self
+ ) -> MessageRow | CallRow | FileTransferJingleRow | None:
children = reversed(self._list_box.get_children())
for row in children:
if isinstance(row, MessageRow | CallRow | FileTransferJingleRow):
return row
return None
+ def get_first_message_row(self
+ ) -> MessageRow | None:
+ for row in self._list_box.get_children():
+ if isinstance(row, MessageRow):
+ return row
+ return None
+
+ def get_last_message_row(
+ self
+ ) -> MessageRow | None:
+ children = reversed(self._list_box.get_children())
+ for row in children:
+ if isinstance(row, MessageRow):
+ return row
+ return None
+
def get_first_event_row(self) -> InfoMessage | MUCJoinLeft | None:
for row in self._list_box.get_children():
if isinstance(row, InfoMessage | MUCJoinLeft):