-static gchar *news_query_password(NNTPSession *session,
- const gchar *user)
-{
- gchar *message;
- gchar *pass;
-
- message = g_strdup_printf
- (_("Input password for %s on %s:"),
- user,
- SESSION(session)->server);
-
- pass = input_dialog_with_invisible(_("Input password"),
- message, NULL);
- g_free(message);
-/* manage_window_focus_in(inc_dialog->mainwin->window, */
-/* NULL, NULL); */
- return pass;
-}
-
-static gint news_authenticate(NNTPSession *session,
- FolderItem *item)
-{
- gint ok;
- const gchar *user;
- gchar *pass;
- gboolean need_free_pass = FALSE;
-
- debug_print(_("news server requested authentication\n"));
- if (!item || !item->folder || !item->folder->account)
- return NN_ERROR;
- user = item->folder->account->userid;
- if (!user)
- return NN_ERROR;
- ok = nntp_authinfo_user(SESSION(session)->sock, user);
- if (ok == NN_AUTHCONT) {
- pass = item->folder->account->passwd;
- if (!pass || !pass[0]) {
- pass = news_query_password(session, user);
- need_free_pass = TRUE;
- }
- ok = nntp_authinfo_pass(SESSION(session)->sock, pass);
- if (need_free_pass)
- g_free(pass);
- }
- if (ok != NN_SUCCESS) {
- log_warning(_("NNTP authentication failed\n"));
- alertpanel_error(_("Authentication for %s on %s failed."),
- user, SESSION(session)->server);
- }
- return ok;
-}
-