"<alt>X", compose_ext_editor_cb, 0, NULL},
{N_("/_Message"), NULL, NULL, 0, "<Branch>"},
- {N_("/_Message/_Send"), "<shift><control>S",
+ {N_("/_Message/_Send"), "<control>Return",
compose_send_cb, 0, NULL},
{N_("/_Message/Send _later"), "<shift><alt>S",
compose_send_later_cb, 0, NULL},
Compose * compose_generic_new(PrefsAccount *account, const gchar *to, FolderItem *item)
{
Compose *compose;
-
+ GList *cur_ac;
+ GList *account_list;
+ PrefsAccount *ac_prefs;
+
+ if (item && item->prefs->enable_default_account) {
+ /* get a PrefsAccount *pointer on the wished account */
+ account_list=account_get_list();
+ for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
+ ac_prefs = (PrefsAccount *)cur_ac->data;
+ if (ac_prefs->account_id == item->prefs->default_account) {
+ account = ac_prefs;
+ break;
+ }
+ }
+ }
if (!account) account = cur_account;
g_return_val_if_fail(account != NULL, NULL);
if (account->protocol != A_NNTP) {
if (to) {
compose_entry_append(compose, to, COMPOSE_TO);
- gtk_widget_grab_focus(compose->subject_entry);
- } else {
- if(item && item->prefs->enable_default_to) {
- compose_entry_append(compose, item->prefs->default_to, COMPOSE_TO);
- } else {
- gtk_widget_grab_focus(compose->header_last->entry);
- }
+ } else if(item && item->prefs->enable_default_to) {
+ compose_entry_append(compose, item->prefs->default_to, COMPOSE_TO);
}
if (item && item->ret_rcpt) {
GtkItemFactory *ifactory;
} else {
if (to) {
compose_entry_append(compose, to, COMPOSE_NEWSGROUPS);
- gtk_widget_grab_focus(compose->subject_entry);
- } else
- gtk_widget_grab_focus(compose->header_last->entry);
+ }
}
+ gtk_widget_grab_focus(compose->subject_entry);
if (prefs_common.auto_exteditor)
compose_exec_ext_editor(compose);
PrefsAccount *account;
PrefsAccount *reply_account;
GtkSText *text;
+ GList *cur_ac;
+ GList *account_list;
+ PrefsAccount *ac_prefs;
g_return_if_fail(msginfo != NULL);
g_return_if_fail(msginfo->folder != NULL);
- account = msginfo->folder->folder->account;
- if (!account && msginfo->to && prefs_common.reply_account_autosel) {
- gchar *to;
- Xstrdup_a(to, msginfo->to, return);
- extract_address(to);
- account = account_find_from_address(to);
+ /* select the account set in folderitem's property (if enabled) */
+ account = NULL;
+ if (msginfo->folder->prefs && msginfo->folder->prefs->enable_default_account) {
+ if (!account) {
+ /* get a PrefsAccount *pointer on the wished account */
+ account_list = account_get_list();
+ for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
+ ac_prefs = (PrefsAccount *)cur_ac->data;
+ if (ac_prefs->account_id == msginfo->folder->prefs->default_account) {
+ account = ac_prefs;
+ break;
+ }
+ }
+ }
}
- if(!account&& prefs_common.reply_account_autosel) {
- gchar cc[BUFFSIZE];
- if(!get_header_from_msginfo(msginfo,cc,sizeof(cc),"CC:")){ /* Found a CC header */
- extract_address(cc);
- account = account_find_from_address(cc);
- }
+
+ /* select the account for the whole folder (IMAP / NNTP) */
+ if (!account)
+ account = msginfo->folder->folder->account;
+
+ /* select account by to: and cc: header if enabled */
+ if (prefs_common.reply_account_autosel) {
+ if (!account && msginfo->to) {
+ gchar *to;
+ Xstrdup_a(to, msginfo->to, return);
+ extract_address(to);
+ account = account_find_from_address(to);
+ }
+ if (!account) {
+ gchar cc[BUFFSIZE];
+ if(!get_header_from_msginfo(msginfo, cc, sizeof(cc), "CC:")) { /* Found a CC header */
+ extract_address(cc);
+ account = account_find_from_address(cc);
+ }
+ }
}
+ /* select current account */
if (!account) account = cur_account;
g_return_if_fail(account != NULL);
return;
} else
reply_account = account;
+
MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_FORWARDED);
MSG_SET_PERM_FLAGS(msginfo->flags, MSG_REPLIED);
else
gtk_widget_grab_focus(compose->newsgroups_entry);
#endif
+ gtk_widget_grab_focus(compose->header_last->entry);
if (prefs_common.auto_exteditor)
compose_exec_ext_editor(compose);
{
GtkSText *text = GTK_STEXT(compose->text);
gchar buf[BUFFSIZE];
+ gint len;
FILE *fp;
g_return_if_fail(file != NULL);
gtk_stext_freeze(text);
- while (fgets(buf, sizeof(buf), fp) != NULL)
- gtk_stext_insert(text, NULL, NULL, NULL, buf, -1);
+ while (fgets(buf, sizeof(buf), fp) != NULL) {
+ /* Strip <CR> if DOS/Windoze file, replace <CR> with <LF> if MAC file */
+ len = strlen(buf);
+ if (len > 1 && buf[len - 2] == '\r' && buf[len - 1] == '\n') {
+ buf[len - 2] = '\n';
+ buf[len - 1] = '\0';
+ } else {
+ while (--len > 0)
+ if (buf[len] == '\r')
+ buf[len] = '\n';
+ }
+
+ gtk_stext_insert(text, NULL, NULL, NULL, buf, -1);
+ }
gtk_stext_thaw(text);
#undef GET_STEXT
}
-/* return str length if text at start_pos matches str else return zero */
-static guint gtkstext_str_strcmp(GtkSText *text, guint start_pos,
- guint text_len, gchar *str) {
- guint is_str, i, str_len;
- gchar str_ch;
-
- is_str = 0;
- if (str) {
- str_len = strlen(str);
- is_str = 1;
- for (i = 0; (i < str_len) && (start_pos + i < text_len); i++) {
- str_ch = GTK_STEXT_INDEX(text, start_pos + i);
- if (*(str + i) != str_ch) {
- break;
- }
- }
- if (i == 0 || i < str_len)
- is_str = 0;
- }
-
- return is_str ? str_len : 0;
-}
-
/* return indent length */
static guint get_indent_length(GtkSText *text, guint start_pos,
guint text_len) {
line_len = cur_len + ch_len;
}
- if (cur_len + ch_len > linewrap_len && line_len > 0) {
+ if (cur_len + ch_len > linewrap_len) {
gint tlen;
+ if (line_len == 0) {
+ /* don't wrap URLs */
+ if (is_url_string(text, line_pos, text_len))
+ continue;
+ line_len = cur_pos - line_pos;
+ line_pos = cur_pos;
+ }
+
if (text->use_wchar)
tlen = wctomb(cbuf, (wchar_t)GTK_STEXT_INDEX(text, line_pos - 1));
else {
gchar *header;
gchar *entry;
header = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(((compose_headerentry *)list->data)->combo)->entry));
- entry = gtk_entry_get_text(GTK_ENTRY(((compose_headerentry *)list->data)->entry));
- if(strlen(entry)) {
+ entry = gtk_editable_get_chars(GTK_EDITABLE(((compose_headerentry *)list->data)->entry), 0, -1);
+ g_strstrip(entry);
+ if(entry[0] != '\0') {
for(strptr = recipient_headers; *strptr != NULL; strptr++) {
if(!strcmp(header, (prefs_common.trans_hdr ? gettext(*strptr) : *strptr))) {
recipient_found = TRUE;
}
}
}
+ g_free(entry);
}
return recipient_found;
}
str = gtk_entry_get_text(GTK_ENTRY(headerentry->entry));
Xstrdup_a(str, str, return -1);
g_strstrip(str);
- if(list_append_func)
- *dest_list = list_append_func(*dest_list, str);
- compose_convert_header
- (buf, sizeof(buf), str,
- strlen(header) + 2);
- if(first_address) {
- fprintf(fp, "%s: ", header);
- first_address = FALSE;
- } else {
- fprintf(fp, ", ");
+ if(str[0] != '\0') {
+ if(list_append_func)
+ *dest_list = list_append_func(*dest_list, str);
+ compose_convert_header
+ (buf, sizeof(buf), str,
+ strlen(header) + 2);
+ if(first_address) {
+ fprintf(fp, "%s: ", header);
+ first_address = FALSE;
+ } else {
+ fprintf(fp, ", ");
+ }
+ fprintf(fp, "%s", buf);
}
- fprintf(fp, "%s", buf);
}
}
if(!first_address) {
account->auto_replyto);
#endif
}
+ if (account->protocol != A_NNTP) {
+ gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(compose->header_last->combo)->entry), _("To:"));
+ } else {
+ gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(compose->header_last->combo)->entry), _("Newsgroups:"));
+ }
+
menuitem = gtk_item_factory_get_item(ifactory, "/Tool/Show ruler");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
prefs_common.show_ruler);