aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--wee_slack.py17
2 files changed, 17 insertions, 5 deletions
diff --git a/README.md b/README.md
index fb82724..3c9fe84 100644
--- a/README.md
+++ b/README.md
@@ -170,6 +170,11 @@ Turn off colorized nicks:
/set plugins.var.python.slack_extension.colorize_nicks 0
```
+Set channel prefix to something other than my-slack-subdomain.slack.com (e.g. when using buffers.pl):
+```
+/set plugins.var.python.slack_extension.server_alias.my-slack-subdomain "mysub"
+```
+
Set all read markers to a specific time:
```
/slack setallreadmarkers (time in epoch)
diff --git a/wee_slack.py b/wee_slack.py
index eae2e1d..5e7c683 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -120,6 +120,7 @@ class SlackServer(object):
self.nick = None
self.name = None
self.domain = None
+ self.server_alias = None
self.login_data = None
self.buffer = None
self.token = token
@@ -201,6 +202,12 @@ class SlackServer(object):
self.domain = login_data["team"]["domain"] + ".slack.com"
dbg("connected to {}".format(self.domain))
self.identifier = self.domain
+
+ if not w.config_get_plugin("server_alias.{}".format(login_data["team"]["domain"])):
+ self.server_alias = login_data["team"]["domain"]
+ else:
+ self.server_alias = w.config_get_plugin("server_alias.{}".format(login_data["team"]["domain"]))
+
self.nick = login_data["self"]["name"]
self.create_local_buffer()
@@ -242,7 +249,7 @@ class SlackServer(object):
def create_local_buffer(self):
if not w.buffer_search("", self.domain):
- self.buffer = w.buffer_new(self.domain, "buffer_input_cb", "", "", "")
+ self.buffer = w.buffer_new("{}.server".format(self.server_alias), "buffer_input_cb", "", "", "")
w.buffer_set(self.buffer, "nicklist", "1")
w.nicklist_add_group(self.buffer, '', NICK_GROUP_HERE, "weechat.color.nicklist_group", 1)
@@ -369,11 +376,11 @@ class Channel(object):
self.members_table[user] = self.server.users.find(user)
def create_buffer(self):
- channel_buffer = w.buffer_search("", "{}.{}".format(self.server.domain, self.name))
+ channel_buffer = w.buffer_search("", "{}.{}".format(self.server.server_alias, self.name))
if channel_buffer:
self.channel_buffer = channel_buffer
else:
- self.channel_buffer = w.buffer_new("{}.{}".format(self.server.domain, self.name), "buffer_input_cb", self.name, "", "")
+ self.channel_buffer = w.buffer_new("{}.{}".format(self.server.server_alias, self.name), "buffer_input_cb", self.name, "", "")
if self.type == "im":
w.buffer_set(self.channel_buffer, "localvar_set_type", 'private')
else:
@@ -382,7 +389,7 @@ class Channel(object):
buffer_list_update_next()
def attach_buffer(self):
- channel_buffer = w.buffer_search("", "{}.{}".format(self.server.domain, self.name))
+ channel_buffer = w.buffer_search("", "{}.{}".format(self.server.server_alias, self.name))
if channel_buffer != main_weechat_buffer:
self.channel_buffer = channel_buffer
w.buffer_set(self.channel_buffer, "localvar_set_nick", self.server.nick)
@@ -417,7 +424,7 @@ class Channel(object):
dbg("DEBUG: {} {} {}".format(self.identifier, self.name, e))
def fullname(self):
- return "{}.{}".format(self.server.domain, self.name)
+ return "{}.{}".format(self.server.server_alias, self.name)
def has_user(self, name):
return name in self.members