weechat-matrix: Fetch from the backlog if the buffer has < 10 lines at startup.
This commit is contained in:
parent
f48a69a6b6
commit
e5f6b597af
2 changed files with 9 additions and 1 deletions
4
main.py
4
main.py
|
@ -578,7 +578,9 @@ def buffer_switch_cb(_, _signal, buffer_ptr):
|
|||
# The buffer is empty and we are seeing it for the first time.
|
||||
# Let us fetch some messages from the room history so it doesn't feel so
|
||||
# empty.
|
||||
if room_buffer.first_view and not last_event_id:
|
||||
if room_buffer.first_view and room_buffer.weechat_buffer.num_lines < 10:
|
||||
# TODO we may want to fetch 10 - num_lines messages here for
|
||||
# consistency reasons.
|
||||
if server.room_get_messages(room_buffer.room.room_id):
|
||||
room_buffer.first_view = True
|
||||
|
||||
|
|
|
@ -446,6 +446,12 @@ class WeechatChannelBuffer(object):
|
|||
"""Get the bar item input text of the buffer."""
|
||||
return W.buffer_get_string(self._ptr, "input")
|
||||
|
||||
@property
|
||||
def num_lines(self):
|
||||
own_lines = W.hdata_pointer(self._hdata, self._ptr, "own_lines")
|
||||
return W.hdata_integer(W.hdata_get("lines"), own_lines, "lines_count")
|
||||
|
||||
|
||||
@property
|
||||
def lines(self):
|
||||
own_lines = W.hdata_pointer(self._hdata, self._ptr, "own_lines")
|
||||
|
|
Loading…
Reference in a new issue