buffer: Set the buffer type to private if there are only 2 users.

This commit is contained in:
Damir Jelić 2018-09-12 20:15:07 +02:00
parent bb510e453a
commit c9ce402c2c

View file

@ -314,7 +314,7 @@ class WeechatChannelBuffer(object):
self.topic_author = "" self.topic_author = ""
self.topic_date = None 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, "type", "formatted")
W.buffer_set(self._ptr, "localvar_set_channel", name) W.buffer_set(self._ptr, "localvar_set_channel", name)
@ -638,6 +638,9 @@ class WeechatChannelBuffer(object):
self._add_user_to_nicklist(user) self._add_user_to_nicklist(user)
self.users[user.nick] = user self.users[user.nick] = user
if len(self.users) > 2:
W.buffer_set(self._ptr, "localvar_set_type", "channel")
if message: if message:
tags = self._message_tags(user, "join") tags = self._message_tags(user, "join")
msg = self._membership_message(user, "join") msg = self._membership_message(user, "join")
@ -667,6 +670,9 @@ class WeechatChannelBuffer(object):
user = self._get_user(nick) user = self._get_user(nick)
self._remove_user_from_nicklist(user) self._remove_user_from_nicklist(user)
if len(self.users) <= 2:
W.buffer_set(self._ptr, "localvar_set_type", "private")
if message: if message:
tags = self._message_tags(user, leave_type) tags = self._message_tags(user, leave_type)