loggedIn :: YukariSettings -> Curl -> IO Bool
loggedIn s c = do
  let settings = s ^. siteSettings
  body <- getInternalPage s c (settings ^. baseSite)
  case body of
    Nothing -> error "Failed to successfully grab the login page."
    Just body' -> do
      let b = "forums.php" `isInfixOf` body'
      unless b $ verbPrint Debug s [ "Failed to log in. username:"
                                   , settings ^. username
                                   , "password:"
                                   , settings ^. password
                                     ++ "\nBody:\n" ++ body'
                                   ]
      return $ "forums.php" `isInfixOf` body'

-- | Log in to the site.
loggedIn :: YukariSettings -> Curl -> IO Bool
loggedIn s c = do
  let settings = s ^. siteSettings
  body <- getInternalPage s c (settings ^. baseSite)
  case body of
    Nothing -> error "Failed to successfully grab the login page."
    Just body' -> do
      let b = "forums.php" `isInfixOf` body'
      unless b $ verbPrint Debug s [ "Failed to log in. username:"
                                   , settings ^. username
                                   , "password:"
                                   , settings ^. password
                                     ++ "\nBody:\n" ++ body'
                                   ]
      return $ "forums.php" `isInfixOf` body'

-- | Log in to the site.
loggedIn s c = do
  let settings = s ^. siteSettings
  body <- getInternalPage s c (settings ^. baseSite)
  case body of
    Nothing -> error "Failed to successfully grab the login page."
    Just body' -> do
      let b = "forums.php" `isInfixOf` body'
      unless b $ verbPrint Debug s [ "Failed to log in. username:"
                                   , settings ^. username
                                   , "password:"
                                   , settings ^. password
                                     ++ "\nBody:\n" ++ body'
                                   ]
      return $ "forums.php" `isInfixOf` body'

-- | Log in to the site.