ekmartin / slack-irc

Connects Slack and IRC channels by sending messages back and forth.
MIT License
588 stars 155 forks source link

Race condition when channel requires nickserv identification #196

Closed denravonska closed 7 years ago

denravonska commented 7 years ago

There seems to be a race between identifying with nickserv and joining channels which require identification:

marco@minerbuntu2:~$ slack-irc --config ./slack-irc-config.json 
9 May 21:56:57 - Sending irc NICK/USER
9 May 21:56:57 - SEND: NICK gridcoin-slack
9 May 21:56:57 - SEND: USER gridcoin-slack 8 * gridcoin-slack
9 May 21:56:57 - SEND: PRIVMSG NickServ :identify xxxxxxxxxxxxxxx
9 May 21:56:57 - SEND: WHOIS gridcoin-slack
9 May 21:56:57 - SEND: JOIN #gridcoin
9 May 21:56:57 - MODE: gridcoin-slack sets mode: +Zi
9 May 21:56:58 - GOT NOTICE from "NickServ": "This nickname is registered. Please choose a different nickname, or identify via /msg NickServ identify <password>."
9 May 21:57:03 - Unhandled message: { prefix: 'card.freenode.net',
  server: 'card.freenode.net',
  command: '671',
  rawCommand: '671',
  commandType: 'normal',
  args: 
     'gridcoin-slack',
     'is connecting from *@h-95-103.a160.priv.bahnhof.se 79.136.95.103' ] }
9 May 21:57:03 - Unhandled message: { prefix: 'card.freenode.net',
  server: 'card.freenode.net',
  command: '477',
  rawCommand: '477',
  commandType: 'normal',
  args: 
   [ 'gridcoin-slack',
     '#gridcoin',
     'Cannot join channel (+r) - you need to be identified with services' ] }
9 May 21:57:03 - GOT NOTICE from "NickServ": "You are now identified for gridcoin-slack."

The identification succeeds but only after the attempt to join the channel fails.

ekmartin commented 7 years ago

Ah, that's ugly. Should probably have some kind of retry for joining channels.

On Freenode you could try using SASL for NickServ - that should happen during connect time. Example config snippet:

"ircOptions": {
  "userName": "nickserv-username",
  "password": "nickserv-pw",
  "sasl": true
}