aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2017-02-04 14:03:09 -0800
committerRyan Huber <rhuber@gmail.com>2017-02-04 14:03:09 -0800
commite20c3aabc9ef1b55bfed19d4422e82831bb27b77 (patch)
treef6c670be88dff215cb3d724a8d617027a39e0d99 /wee_slack.py
parentf0108a584f48e951212f58199e466e2fa6fba0e2 (diff)
downloadwee-slack-e20c3aabc9ef1b55bfed19d4422e82831bb27b77.tar.gz
channels work properly
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/wee_slack.py b/wee_slack.py
index f17c7f6..15e5391 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -609,7 +609,7 @@ class SlackTeam(object):
def get_channel_map(self):
return {v.slack_name: k for k, v in self.channels.iteritems()}
def get_username_map(self):
- return {v.name: k for k, v in self.users.iteritems()}
+ return {v.slack_name: k for k, v in self.users.iteritems()}
def get_team_hash(self):
return self.team_hash
def refresh(self):
@@ -711,11 +711,11 @@ class SlackChannel(object):
#self.active = True
self.get_history()
if "info" in SLACK_API_TRANSLATOR[self.type]:
- s = SlackRequest(self.team.token, SLACK_API_TRANSLATOR[self.type]["info"], {"name": self.slack_name}, team_hash=self.team.team_hash, channel_identifier=self.identifier)
+ s = SlackRequest(self.team.token, SLACK_API_TRANSLATOR[self.type]["info"], {"name": self.identifier}, team_hash=self.team.team_hash, channel_identifier=self.identifier)
self.eventrouter.receive(s)
if update_remote:
if "join" in SLACK_API_TRANSLATOR[self.type]:
- s = SlackRequest(self.team.token, SLACK_API_TRANSLATOR[self.type]["join"], {"name": self.slack_name}, team_hash=self.team.team_hash, channel_identifier=self.identifier)
+ s = SlackRequest(self.team.token, SLACK_API_TRANSLATOR[self.type]["join"], {"name": self.name}, team_hash=self.team.team_hash, channel_identifier=self.identifier)
self.eventrouter.receive(s)
self.create_buffer()
def check_should_open(self, force=False):
@@ -926,6 +926,18 @@ class SlackDMChannel(SlackChannel):
"long_base": "{}.{}".format(self.team.domain, self.slack_name),
}
return print_color + select[style]
+ def open(self, update_remote=True):
+ self.create_buffer()
+ #self.active = True
+ self.get_history()
+ if "info" in SLACK_API_TRANSLATOR[self.type]:
+ s = SlackRequest(self.team.token, SLACK_API_TRANSLATOR[self.type]["info"], {"name": self.identifier}, team_hash=self.team.team_hash, channel_identifier=self.identifier)
+ self.eventrouter.receive(s)
+ if update_remote:
+ if "join" in SLACK_API_TRANSLATOR[self.type]:
+ s = SlackRequest(self.team.token, SLACK_API_TRANSLATOR[self.type]["join"], {"user": self.user}, team_hash=self.team.team_hash, channel_identifier=self.identifier)
+ self.eventrouter.receive(s)
+ self.create_buffer()
def rename(self):
if self.channel_buffer:
new_name = self.formatted_name(style="sidebar", present=self.team.is_user_present(self.user), enable_color=config.colorize_private_chats)
@@ -992,6 +1004,7 @@ class SlackUser(object):
# We require these two things for a vaid object,
# the rest we can just learn from slack
self.identifier = kwargs["id"]
+ self.slack_name = kwargs["name"]
self.name = kwargs["name"]
for key, value in kwargs.items():
setattr(self, key, value)
@@ -1033,6 +1046,7 @@ class SlackMessage(object):
self.team = team
self.channel = channel
self.message_json = message_json
+ self.submessages = None
self.sender = self.get_sender()
self.suffix = ''
self.ts = SlackTS(message_json['ts'])