Implement none and next functionality for new_channel_position

This commit is contained in:
Marco Sirabella 2019-11-19 20:53:28 -05:00
parent 56e6781abe
commit 56aa9992a9
No known key found for this signature in database
GPG key ID: 350CE23EFB20D1A7

View file

@ -54,7 +54,7 @@ from nio import (
from . import globals as G from . import globals as G
from .colors import Formatted from .colors import Formatted
from .config import RedactType from .config import RedactType, NewChannelPosition
from .globals import SCRIPT_NAME, SERVERS, W, TYPING_NOTICE_TIMEOUT from .globals import SCRIPT_NAME, SERVERS, W, TYPING_NOTICE_TIMEOUT
from .utf import utf8_decode from .utf import utf8_decode
from .message_renderer import Render from .message_renderer import Render
@ -357,6 +357,9 @@ class WeechatChannelBuffer(object):
def __init__(self, name, server_name, user): def __init__(self, name, server_name, user):
# type: (str, str, str) -> None # 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( self._ptr = W.buffer_new(
name, name,
"room_buffer_input_cb", "room_buffer_input_cb",
@ -365,6 +368,14 @@ class WeechatChannelBuffer(object):
server_name, 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.name = ""
self.users = {} # type: Dict[str, WeechatUser] self.users = {} # type: Dict[str, WeechatUser]
self.smart_filtered_nicks = set() # type: Set[str] self.smart_filtered_nicks = set() # type: Set[str]