diff --git a/matrix/buffer.py b/matrix/buffer.py index dfec6f7..6b0eac4 100644 --- a/matrix/buffer.py +++ b/matrix/buffer.py @@ -54,7 +54,7 @@ from nio import ( from . import globals as G from .colors import Formatted -from .config import RedactType +from .config import RedactType, NewChannelPosition from .globals import SCRIPT_NAME, SERVERS, W, TYPING_NOTICE_TIMEOUT from .utf import utf8_decode from .message_renderer import Render @@ -357,6 +357,9 @@ class WeechatChannelBuffer(object): def __init__(self, name, server_name, user): # type: (str, str, str) -> None + + # Previous buffer num before create + cur_num = W.buffer_get_integer(W.current_buffer(), "number") self._ptr = W.buffer_new( name, "room_buffer_input_cb", @@ -365,6 +368,14 @@ class WeechatChannelBuffer(object): server_name, ) + new_channel_position = G.CONFIG.look.new_channel_position + if new_channel_position == NewChannelPosition.NONE: + pass + elif new_channel_position == NewChannelPosition.NEXT: + W.buffer_set(self._ptr, "number", str(cur_num + 1)) + elif new_channel_position == NewChannelPosition.NEAR_SERVER: + pass + self.name = "" self.users = {} # type: Dict[str, WeechatUser] self.smart_filtered_nicks = set() # type: Set[str]