From 1989915405916c5f1a381e381b25d294f1d636ac Mon Sep 17 00:00:00 2001 From: karxi Date: Mon, 2 Jan 2017 14:14:57 -0500 Subject: [PATCH] Allowed consecutive memo joins (comma-separated) --- TODO.mkdn | 4 ++-- pesterchum.py | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/TODO.mkdn b/TODO.mkdn index 835cb59..b0a7c58 100644 --- a/TODO.mkdn +++ b/TODO.mkdn @@ -41,7 +41,7 @@ reconnect? * It'd probably be best to give an option to either CHANGE NICKS or DISCONNECT upon nick collision...? But, then how would we GHOST? - * Auto-disconnect if collsion before joining channels, make it + * Auto-disconnect if collision before joining channels, make it possible to disconnect (but not send messages, obviously) without losing everything * Maybe GHOSTing should use auto-identify to ensure- no, that doesn't @@ -57,7 +57,6 @@ * Right-click Time entry field to see those used? (Replace left/right buttons?) * Save commonly-used times on a per-handle basis! -* Make the memo name entry box accept a comma-separated list * Make the memo list highlight/recolor the names of channels you're in (including secret ones) * Make right-clicking on a tab open up the right-click menu one would get on @@ -160,6 +159,7 @@ version of the client. There aren't really any other choices. * Fix NickServ auto-login things * Make a window that can be used to interface with the script directly - a simple Python console. +* Make the memo name entry box accept a comma-separated list ### Backend * Perpetual code cleanup, refactoring, simplification and general improvements diff --git a/pesterchum.py b/pesterchum.py index 6faf9bb..f55d91b 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -2301,9 +2301,17 @@ class PesterWindow(MovingWindow): if self.memochooser.newmemoname(): newmemo = self.memochooser.newmemoname() - channel = "#"+unicode(newmemo).replace(" ", "_") - channel = re.sub(r"[^A-Za-z0-9#_]", "", channel) - self.newMemo(channel, time, secret=secret, invite=invite) + channel = unicode(newmemo).replace(" ", "_") + channel = re.sub(r"[^A-Za-z0-9#_\,]", "", channel) + # Allow us to join more than one with this. + chans = channel.split(',') + # Filter out empty entries. + chans = filter(None, chans) + for c in chans: + c = '#' + c + # We should really change this code to only make the memo once + # the server has confirmed that we've joined.... + self.newMemo(c, time, secret=secret, invite=invite) for SelectedMemo in self.memochooser.SelectedMemos(): channel = "#"+unicode(SelectedMemo.target)