From c9ce402c2c66b331c2b3c951d196fe7a2136f56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 12 Sep 2018 20:15:07 +0200 Subject: [PATCH] buffer: Set the buffer type to private if there are only 2 users. --- matrix/buffer.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/matrix/buffer.py b/matrix/buffer.py index 379a5dc..3c55f78 100644 --- a/matrix/buffer.py +++ b/matrix/buffer.py @@ -314,7 +314,7 @@ class WeechatChannelBuffer(object): self.topic_author = "" self.topic_date = None - W.buffer_set(self._ptr, "localvar_set_type", "channel") + W.buffer_set(self._ptr, "localvar_set_type", "private") W.buffer_set(self._ptr, "type", "formatted") W.buffer_set(self._ptr, "localvar_set_channel", name) @@ -638,6 +638,9 @@ class WeechatChannelBuffer(object): self._add_user_to_nicklist(user) self.users[user.nick] = user + if len(self.users) > 2: + W.buffer_set(self._ptr, "localvar_set_type", "channel") + if message: tags = self._message_tags(user, "join") msg = self._membership_message(user, "join") @@ -667,6 +670,9 @@ class WeechatChannelBuffer(object): user = self._get_user(nick) self._remove_user_from_nicklist(user) + if len(self.users) <= 2: + W.buffer_set(self._ptr, "localvar_set_type", "private") + if message: tags = self._message_tags(user, leave_type)