#62 IRC problem with password protected channel

v1.0 (example)
closed-fixed
nobody
None
5
2015-03-23
2013-12-15
Brian Millham
No

If you try to set up a message in a password protected channel (i.e. #room:password in the IDJC settings), IDJC will join the room, however no messages are sent.

I've tracked this down to _on_privmsg_ready in irc.py. The message is sent to #room:password instead of just #room.

I changed line 1260 from:
chan_targets = filter(lambda x: x[0] in "#&", targets)
to:
chan_targets = [z.split(":")[0] for z in filter(lambda x: x[0] in "#&", targets)]

and this seems to fix the problem.

I have noticed another problem, and I don't know yet if it's related, but if setting the connection to manual, the connection will not stay up to the IRC. After anywhere from about 10 seconds to a few minutes, IDJC will disconnect from the IRC. The chat window will show "IDJC has quit (EOF from client)"

Discussion

  • Please test the password protected channels now work.

     
    • status: open --> open-fixed
     
  • The disconnect was happening during session save. The connect setting rightly needs to be saved as being not connected when in manual mode but it was setting the actual server connect flag in order to do it. The fix is to just copy the server line and alter a copy instead. This bug arose when I added periodic session save and save on demand (Ladish L0 and L1 modes respectively). Prior to that IDJC only saved when exiting so it didn't matter if a side effect was IRC disconnection.

     
  • Brian Millham
    Brian Millham
    2013-12-16

    Thanks, both problems fixed. Just curious, I noticed that the fix you made for the password problem was almost identical to my fix, except that you removed the call to filter that you had originally used. Is it just because the for loop is more efficient? Nice to know that my fix was close, so I guess that my Python is getting better :)

     
  • Your solution uses a list comprehension and filter function and mine uses the filter feature of list comprehensions for a considerable line length reduction.

    There is not much in it but the filter function is quicker when the test is written in C e.g. you pass bool for the test and it will filter out any boolean false objects. Pass int and it will filter out strings like "0" quickly.

    What is slower is doing two loops and making two lists one of which is intermediate and thrown away.

     
    • status: open-fixed --> closed-fixed