/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static void send_progress_dialog_destroy(SendProgressDialog *dialog);
static void send_cancel(GtkWidget *widget, gpointer data);
-static gchar *send_query_password(const gchar *server, const gchar *user);
-
gint send_message(const gchar *file, PrefsAccount *ac_prefs, GSList *to_list)
{
return -1;
}
- if (prefs_common.use_extsend && prefs_common.extsend_cmd) {
+ printf("account: %p\n", ac_prefs);
+
+ if (ac_prefs->use_mail_command && ac_prefs->mail_command &&
+ (*ac_prefs->mail_command)) {
+ val = send_message_local(ac_prefs->mail_command, fp);
+ fclose(fp);
+ return val;
+ }
+ else if (prefs_common.use_extsend && prefs_common.extsend_cmd) {
val = send_message_local(prefs_common.extsend_cmd, fp);
fclose(fp);
return val;
}
-
- val = send_message_smtp(ac_prefs, to_list, fp);
-
- fclose(fp);
- return val;
+ else {
+ val = send_message_smtp(ac_prefs, to_list, fp);
+
+ fclose(fp);
+ return val;
+ }
}
enum
Q_ACCOUNT_ID = 3
};
+#if 0
gint send_message_queue(const gchar *file)
{
static HeaderEntry qentry[] = {{"S:", NULL, FALSE},
ac = account_find_from_id(atoi(p));
break;
default:
+ break;
}
}
if (!to_list || !from) {
g_warning(_("Queued message header is broken.\n"));
val = -1;
+ } else if (ac && ac->use_mail_command && ac->mail_command &&
+ (*ac->mail_command)) {
+ val = send_message_local(ac->mail_command, fp);
} else if (prefs_common.use_extsend && prefs_common.extsend_cmd) {
val = send_message_local(prefs_common.extsend_cmd, fp);
} else {
return val;
}
+#endif
gint send_message_local(const gchar *command, FILE *fp)
{
FILE *pipefp;
gchar buf[BUFFSIZE];
+ int r;
g_return_val_if_fail(command != NULL, -1);
g_return_val_if_fail(fp != NULL, -1);
fputc('\n', pipefp);
}
- pclose(pipefp);
+ r = pclose(pipefp);
+ if (r != 0) {
+ g_warning(_("external command failed: %s\n"), command);
+ return -1;
+ }
return 0;
}
g_free(ac_prefs->tmp_pass); \
ac_prefs->tmp_pass = NULL; \
} \
+ if (ac_prefs->tmp_smtp_pass) { \
+ g_free(ac_prefs->tmp_smtp_pass); \
+ ac_prefs->tmp_smtp_pass = NULL; \
+ } \
} \
if (smtp_quit(smtp_sock) != SM_OK) \
log_warning("Error occurred while sending QUIT\n"); \
gchar buf[BUFFSIZE];
gushort port;
gchar *domain;
+ gchar *user = NULL;
gchar *pass = NULL;
GSList *cur;
gint size;
domain = ac_prefs->set_domain ? ac_prefs->domain : NULL;
if (ac_prefs->use_smtp_auth) {
- if (ac_prefs->passwd)
- pass = ac_prefs->passwd;
- else if (ac_prefs->tmp_pass)
- pass = ac_prefs->tmp_pass;
- else {
- pass = send_query_password(ac_prefs->smtp_server,
- ac_prefs->userid);
- if (!pass) pass = g_strdup("");
- ac_prefs->tmp_pass = pass;
+ if (ac_prefs->smtp_userid) {
+ user = ac_prefs->smtp_userid;
+ if (ac_prefs->smtp_passwd)
+ pass = ac_prefs->smtp_passwd;
+ else if (ac_prefs->tmp_smtp_pass)
+ pass = ac_prefs->tmp_smtp_pass;
+ else {
+ pass = input_dialog_query_password
+ (ac_prefs->smtp_server, user);
+ if (!pass) pass = g_strdup("");
+ ac_prefs->tmp_smtp_pass = pass;
+ }
+ } else {
+ user = ac_prefs->userid;
+ if (ac_prefs->passwd)
+ pass = ac_prefs->passwd;
+ else if (ac_prefs->tmp_pass)
+ pass = ac_prefs->tmp_pass;
+ else {
+ pass = input_dialog_query_password
+ (ac_prefs->smtp_server, user);
+ if (!pass) pass = g_strdup("");
+ ac_prefs->tmp_pass = pass;
+ }
}
}
GTK_EVENTS_FLUSH();
SEND_EXIT_IF_NOTOK
- (smtp_from(smtp_sock, ac_prefs->address, ac_prefs->userid,
- pass, ac_prefs->use_smtp_auth),
+ (smtp_from(smtp_sock, ac_prefs->address, user, pass,
+ ac_prefs->use_smtp_auth),
"sending MAIL FROM");
progress_dialog_set_label(dialog->dialog, _("Sending RCPT TO..."));
dialog->cancelled = TRUE;
}
-
-static gchar *send_query_password(const gchar *server, const gchar *user)
-{
- gchar *message;
- gchar *pass;
-
- message = g_strdup_printf(_("Input password for %s on %s:"),
- user, server);
- pass = input_dialog_with_invisible(_("Input password"), message, NULL);
- g_free(message);
-
- return pass;
-}