doCapAck ::
  ByteString {- ^ raw, spaces delimited caps list -} ->
  IrcConnection -> Logic IrcConnection
doCapAck rawCaps conn =
  let ackCaps = B8.words rawCaps in
  case view connSasl conn of
    Just{} | "sasl" `elem` ackCaps ->
         do sendMessage (authenticateCmd "PLAIN")
            return (set connPhase SaslPhase conn)
    _ -> do sendMessage capEndCmd
            return conn
doCapAck ::
  ByteString {- ^ raw, spaces delimited caps list -} ->
  IrcConnection -> Logic IrcConnection
doCapAck rawCaps conn =
  let ackCaps = B8.words rawCaps in
  case view connSasl conn of
    Just{} | "sasl" `elem` ackCaps ->
         do sendMessage (authenticateCmd "PLAIN")
            return (set connPhase SaslPhase conn)
    _ -> do sendMessage capEndCmd
            return conn
doCapAck rawCaps conn =
  let ackCaps = B8.words rawCaps in
  case view connSasl conn of
    Just{} | "sasl" `elem` ackCaps ->
         do sendMessage (authenticateCmd "PLAIN")
            return (set connPhase SaslPhase conn)
    _ -> do sendMessage capEndCmd
            return conn