aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-07-09 03:32:02 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2020-07-09 03:32:02 +0200
commit13b93fa12d1a964a6677d23032fd398b8732a03d (patch)
treeb671f0bc10157639bd51f4e7dc02ffbf83045cf1 /wee_slack.py
parent087bb0e969904085152352db39815a5c89da1b72 (diff)
downloadwee-slack-13b93fa12d1a964a6677d23032fd398b8732a03d.tar.gz
Set buffer localvar slack_type
The localvar type has to be set to server, channel or private for things to work properly. Add slack_type so you can differentiate between channels, groups/private channels, threads, ims and mpims.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index a6471a6..77b861e 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1295,6 +1295,7 @@ class SlackTeam(object):
def __init__(self, eventrouter, token, team_hash, websocket_url, team_info, subteams, nick, myidentifier, my_manual_presence, users, bots, channels, **kwargs):
self.slack_api_translator = copy.deepcopy(SLACK_API_TRANSLATOR)
self.identifier = team_info["id"]
+ self.type = "team"
self.active = True
self.team_hash = team_hash
self.ws_url = websocket_url
@@ -1339,7 +1340,6 @@ class SlackTeam(object):
self.users[self.myidentifier].force_color(w.config_string(w.config_get('weechat.color.chat_nick_self')))
# This highlight step must happen after we have set related server
self.load_emoji_completions()
- self.type = "team"
def __repr__(self):
return "domain={} nick={}".format(self.subdomain, self.nick)
@@ -1378,6 +1378,7 @@ class SlackTeam(object):
self.channel_buffer = w.buffer_new(self.name, "buffer_input_callback", "EVENTROUTER", "", "")
self.eventrouter.weechat_controller.register_buffer(self.channel_buffer, self)
w.buffer_set(self.channel_buffer, "localvar_set_type", 'server')
+ w.buffer_set(self.channel_buffer, "localvar_set_slack_type", self.type)
w.buffer_set(self.channel_buffer, "localvar_set_nick", self.nick)
w.buffer_set(self.channel_buffer, "localvar_set_server", self.name)
self.buffer_merge()
@@ -1963,6 +1964,7 @@ class SlackChannel(SlackChannelCommon):
w.buffer_set(self.channel_buffer, "localvar_set_type", 'private')
else:
w.buffer_set(self.channel_buffer, "localvar_set_type", 'channel')
+ w.buffer_set(self.channel_buffer, "localvar_set_slack_type", self.type)
w.buffer_set(self.channel_buffer, "localvar_set_channel", self.formatted_name())
w.buffer_set(self.channel_buffer, "localvar_set_nick", self.team.nick)
self.buffer_rename_in_progress = True
@@ -2590,6 +2592,7 @@ class SlackThreadChannel(SlackChannelCommon):
self.channel_buffer = w.buffer_new(self.formatted_name(style="long_default"), "buffer_input_callback", "EVENTROUTER", "", "")
self.eventrouter.weechat_controller.register_buffer(self.channel_buffer, self)
w.buffer_set(self.channel_buffer, "localvar_set_type", 'channel')
+ w.buffer_set(self.channel_buffer, "localvar_set_slack_type", self.type)
w.buffer_set(self.channel_buffer, "localvar_set_nick", self.team.nick)
w.buffer_set(self.channel_buffer, "localvar_set_channel", self.formatted_name())
w.buffer_set(self.channel_buffer, "localvar_set_server", self.team.name)