/* Passwords are handled outside of PrefParams. */
buf = passwd_store_get_account(ac_prefs->account_id,
PWS_ACCOUNT_RECV);
- gtk_entry_set_text(GTK_ENTRY(page->pass_entry), buf);
- g_free(buf);
+ gtk_entry_set_text(GTK_ENTRY(page->pass_entry), buf != NULL ? buf : "");
+ if (buf != NULL) {
+ memset(buf, 0, strlen(buf));
+ g_free(buf);
+ }
}
page->vbox = vbox1;
/* Passwords are handled outside of PrefParams. */
buf = passwd_store_get_account(ac_prefs->account_id,
PWS_ACCOUNT_SEND);
- gtk_entry_set_text(GTK_ENTRY(page->smtp_pass_entry), buf);
- g_free(buf);
+ gtk_entry_set_text(GTK_ENTRY(page->smtp_pass_entry), buf != NULL ? buf : "");
+ if (buf != NULL) {
+ memset(buf, 0, strlen(buf));
+ g_free(buf);
+ }
}
pop_bfr_smtp_tm_set_sens (NULL, NULL);
/* Passwords are handled outside of PrefParams. */
buf = passwd_store_get_account(ac_prefs->account_id,
PWS_ACCOUNT_RECV_CERT);
- gtk_entry_set_text(GTK_ENTRY(page->entry_in_cert_pass), buf);
- g_free(buf);
+ gtk_entry_set_text(GTK_ENTRY(page->entry_in_cert_pass), buf != NULL ? buf : "");
+ if (buf != NULL) {
+ memset(buf, 0, strlen(buf));
+ g_free(buf);
+ }
+
buf = passwd_store_get_account(ac_prefs->account_id,
PWS_ACCOUNT_SEND_CERT);
- gtk_entry_set_text(GTK_ENTRY(page->entry_out_cert_pass), buf);
- g_free(buf);
+ gtk_entry_set_text(GTK_ENTRY(page->entry_out_cert_pass), buf != NULL ? buf : "");
+ if (buf != NULL) {
+ memset(buf, 0, strlen(buf));
+ g_free(buf);
+ }
}
page->vbox = vbox1;
}
#endif
+gchar *prefs_account_generate_msgid(PrefsAccount *account)
+{
+ gchar *addr, *tmbuf, *buf = NULL;
+ GDateTime *now;
+ gchar *user_addr = account->msgid_with_addr ? account->address : NULL;
+
+ if (account->set_domain && account->domain) {
+ buf = g_strdup(account->domain);
+ } else if (!strncmp(get_domain_name(), "localhost", strlen("localhost"))) {
+ buf = g_strdup(
+ strchr(account->address, '@') ?
+ strchr(account->address, '@')+1 :
+ account->address);
+ }
+
+ if (user_addr != NULL) {
+ addr = g_strdup_printf(".%s", user_addr);
+ } else {
+ addr = g_strdup_printf("@%s",
+ buf != NULL && strlen(buf) > 0 ?
+ buf : get_domain_name());
+ }
+
+ if (buf != NULL)
+ g_free(buf);
+ if (user_addr != NULL)
+ g_free(user_addr);
+
+ /* Replace all @ but the last one in addr, with underscores.
+ * RFC 2822 States that msg-id syntax only allows one @.
+ */
+ while (strchr(addr, '@') != NULL && strchr(addr, '@') != strrchr(addr, '@'))
+ *(strchr(addr, '@')) = '_';
+
+ now = g_date_time_new_now_local();
+ tmbuf = g_date_time_format(now, "%Y%m%d%H%M%S");
+ buf = g_strdup_printf("%s.%08x%s",
+ tmbuf, (guint)rand(), addr);
+ g_free(tmbuf);
+ g_free(addr);
+
+ debug_print("Generated Message-ID string '%s'\n", buf);
+ return buf;
+}
+
void prefs_account_register_page(PrefsPage *page)
{
prefs_pages = g_slist_append(prefs_pages, page);