Canonicalize the channel name early. Avoids a very weird bug.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 1 Oct 2012 05:58:00 +0000 (01:58 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 1 Oct 2012 05:59:03 +0000 (01:59 -0400)
irkerd

diff --git a/irkerd b/irkerd
index d0bc8ff1273ffb4beb29a29ff9a3367aa3493fae..598017b55801ede85bdbd6c46515ef7649c98feb 100755 (executable)
--- a/irkerd
+++ b/irkerd
@@ -204,8 +204,6 @@ class Connection:
                 (channel, message) = self.queue.get()
                 if channel not in self.channels_joined:
                     self.channels_joined.append(channel)
-                    if channel[0] not in "#&+":
-                        channel = "#" + channel
                     self.connection.join(channel)
                 for segment in message.split("\n"):
                     self.connection.privmsg(channel, segment)
@@ -239,6 +237,8 @@ class Target():
             ircport = 6667
         self.servername = irchost
         self.channel = parsed.path.lstrip('/')
+        if self.channel[0] not in "#&+":
+            self.channel = "#" + self.channel
         self.port = int(ircport)
     def valid(self):
         "Both components must be present for a valid target."