if (msginfo->subject && *msginfo->subject) {
gchar *buf, *buf2, *p;
- buf = g_strdup(msginfo->subject);
- while (!strncasecmp(buf, "Re:", 3)) {
- p = buf + 3;
- while (isspace(*p)) p++;
- memmove(buf, p, strlen(p) + 1);
- }
+ buf = p = g_strdup(msginfo->subject);
+ p += subject_get_reply_prefix_length(p);
+ memmove(buf, p, strlen(p) + 1);
buf2 = g_strdup_printf("Re: %s", buf);
gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), buf2);
gtk_stext_freeze(text);
if (replace && compose->sig_str) {
- gchar *tmp;
gint pos;
gint len;
- if (compose->account->sig_sep)
- tmp = g_strconcat(compose->account->sig_sep, "\n",
- compose->sig_str, NULL);
- else
- tmp = g_strdup(compose->sig_str);
-
- if (tmp[0] == '\0')
+ if (compose->sig_str[0] == '\0')
pos = -1;
else
- pos = gtkut_stext_find(text, 0, tmp, TRUE);
+ pos = gtkut_stext_find(text, 0, compose->sig_str, TRUE);
if (pos != -1) {
- len = get_mbs_len(tmp);
+ len = get_mbs_len(compose->sig_str);
if (len >= 0) {
gtk_stext_set_point(text, pos);
gtk_stext_forward_delete(text, len);
len = gtk_stext_get_length(text);
gtk_stext_set_point(text, len);
}
-
- g_free(tmp);
} else
gtk_stext_insert(text, NULL, NULL, NULL, "\n\n", 2);
- if (compose->account->sig_sep) {
- gtk_stext_insert(text, NULL, NULL, NULL,
- compose->account->sig_sep, -1);
- gtk_stext_insert(text, NULL, NULL, NULL, "\n", 1);
- }
-
g_free(compose->sig_str);
compose->sig_str = compose_get_signature_str(compose);
- if (!compose->sig_str)
+ if (!compose->sig_str || (replace && !compose->account->auto_sig))
compose->sig_str = g_strdup("");
gtk_stext_insert(text, NULL, NULL, NULL, compose->sig_str, -1);
static gchar *compose_get_signature_str(Compose *compose)
{
- static gchar *default_sigfile;
- gchar *sig_file = NULL;
+ gchar *sig_body = NULL;
gchar *sig_str = NULL;
g_return_val_if_fail(compose->account != NULL, NULL);
- if (compose->account->sig_type == SIG_FILE) {
- if (compose->account->sig_path)
- sig_file = compose->account->sig_path;
- else {
- if (!default_sigfile)
- default_sigfile = g_strconcat
- (get_home_dir(), G_DIR_SEPARATOR_S,
- DEFAULT_SIGNATURE, NULL);
- sig_file = default_sigfile;
- }
+ if (!compose->account->sig_path)
+ return NULL;
- if (!is_file_or_fifo_exist(sig_file)) {
- g_warning("can't open signature file: %s\n", sig_file);
+ if (compose->account->sig_type == SIG_FILE) {
+ if (!is_file_or_fifo_exist(compose->account->sig_path)) {
+ g_warning("can't open signature file: %s\n",
+ compose->account->sig_path);
return NULL;
}
}
- if (compose->account->sig_type == SIG_COMMAND) {
- if (compose->account->sig_path)
- sig_str = get_command_output
- (compose->account->sig_path);
- } else {
+ if (compose->account->sig_type == SIG_COMMAND)
+ sig_body = get_command_output(compose->account->sig_path);
+ else {
gchar *tmp;
- tmp = file_read_to_str(sig_file);
+ tmp = file_read_to_str(compose->account->sig_path);
if (!tmp)
return NULL;
- sig_str = normalize_newlines(tmp);
+ sig_body = normalize_newlines(tmp);
g_free(tmp);
}
+ if (compose->account->sig_sep) {
+ sig_str = g_strconcat(compose->account->sig_sep, "\n", sig_body,
+ NULL);
+ g_free(sig_body);
+ } else
+ sig_str = sig_body;
+
return sig_str;
}
STEXT_FREEZE();
gtk_stext_set_point(text, line_pos);
gtk_stext_insert(text, NULL, NULL, NULL, "\n", 1);
- /* gtk_stext_compact_buffer(text); */
+ gtk_stext_compact_buffer(text);
tlen++;
line_pos++;
/* for loop will increase it */
activate_gnupg_mode(compose, account);
#endif /* USE_GPGME */
- if (!init && account->auto_sig)
+ if (!init)
compose_insert_sig(compose, TRUE);
}
if (mode != COMPOSE_REDIRECT) {
if (prefs_common.enable_aspell && prefs_common.dictionary &&
strcmp(prefs_common.dictionary, _("None"))) {
- gtkaspell = gtkaspell_new((const gchar*)prefs_common.dictionary,
+ gtkaspell = gtkaspell_new(prefs_common.aspell_path,
+ prefs_common.dictionary,
conv_get_current_charset_str(),
prefs_common.misspelled_col,
prefs_common.check_while_typing,
prefs_common.use_alternate,
GTK_STEXT(text));
if (!gtkaspell) {
- alertpanel_error(_("Spell checker could not be started.\n%s"), gtkaspellcheckers->error_message);
+ alertpanel_error(_("Spell checker could not "
+ "be started.\n%s"),
+ gtkaspell_checkers_strerror());
gtkaspell_checkers_reset_error();
} else {
GtkWidget *menuitem;
- if (!gtkaspell_set_sug_mode(gtkaspell, prefs_common.aspell_sugmode)) {
- debug_print("Aspell: could not set suggestion mode %s\n",
- gtkaspellcheckers->error_message);
+ if (!gtkaspell_set_sug_mode(gtkaspell,
+ prefs_common.aspell_sugmode)) {
+ debug_print("Aspell: could not set "
+ "suggestion mode %s\n",
+ gtkaspell_checkers_strerror());
gtkaspell_checkers_reset_error();
}
- menuitem = gtk_item_factory_get_item(ifactory, "/Spelling/Spelling Configuration");
+ menuitem = gtk_item_factory_get_item(ifactory,
+ "/Spelling/Spelling Configuration");
gtkaspell_populate_submenu(gtkaspell, menuitem);
menu_set_sensitive(ifactory, "/Spelling", TRUE);
}