diff options
author | Ryan Huber <rhuber@gmail.com> | 2017-02-06 02:27:47 -0800 |
---|---|---|
committer | Ryan Huber <rhuber@gmail.com> | 2017-02-06 02:27:47 -0800 |
commit | 1f3cbb910b9b7e245af912c9d7b23523aa30318e (patch) | |
tree | 1e432a1232de76b37dc133fb9f30d99195741e4c | |
parent | 982f100a1b4e02f97ebc909fdc68a53c3d4fb3b7 (diff) | |
download | wee-slack-1f3cbb910b9b7e245af912c9d7b23523aa30318e.tar.gz |
fix up join/leave
-rw-r--r-- | wee_slack.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/wee_slack.py b/wee_slack.py index 529b469..67a8635 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -883,6 +883,7 @@ class SlackChannel(object): self.active = False for key, value in kwargs.items(): setattr(self, key, value) + self.members = set(kwargs.get('members', set())) self.eventrouter = eventrouter self.slack_name = kwargs["name"] self.identifier = kwargs["id"] @@ -1019,14 +1020,14 @@ class SlackChannel(object): #backlog messages - we will update the read marker as we print these try: backlog = False - if ts <= SlackTS(self.last_read): + if nick in [w.prefix("join"), w.prefix("quit")]: + tags = tag("joinleave") + elif ts <= SlackTS(self.last_read): tags = tag("backlog") backlog = True elif self.type in ["im", "mpdm"]: tags = tag("dm") self.new_messages = True - elif nick in [x.strip() for x in w.prefix("join"), w.prefix("quit")]: - tags = tag("joinleave") else: tags = tag("default") self.new_messages = True @@ -1160,16 +1161,15 @@ class SlackChannel(object): self.eventrouter.receive(s) self.new_messages = False def user_joined(self, user_id): - pass - #print type(self.members) - #print self.members - #print self - #self.members.append(user_id) - #self.update_nicklist(user_id) + #ugly hack - for some reason this gets turned into a list + self.members = set(self.members) + self.members.add(user_id) + self.update_nicklist(user_id) def user_left(self, user_id): - pass + #pass #filter(lambda u: u != user_id, self.members) - #self.update_nicklist(user_id) + self.members.discard(user_id) + self.update_nicklist(user_id) def update_nicklist(self, user=None): if not self.channel_buffer: return |