+2003-01-05 [colin] 0.8.8claws49
+
+ * src/account.[ch]
+ Add account_get_reply_account function
+ * src/compose.c
+ Use account_get_reply_account function
+ * src/summaryview.c
+ Basic reply-finder - click on the replied
+ icon gets you to the outbox using quick-search
+
2003-01-05 [paul] 0.8.8claws48
* src/prefs_common.c
MICRO_VERSION=8
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws48
+EXTRA_VERSION=claws49
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
row++)
account_list = g_list_append(account_list, ac_prefs);
}
+
+/*!
+ *\brief finds the PrefsAccounts which should be used to answer a mail
+ *
+ *\param msginfo The message to be answered
+ *\param reply_autosel Indicates whether reply account autoselection is on
+ *
+ *\return PrefsAccount * the correct account, NULL if not found
+ */
+PrefsAccount *account_get_reply_account(MsgInfo *msginfo, gboolean reply_autosel)
+{
+ PrefsAccount *account = NULL;
+ /* select the account set in folderitem's property (if enabled) */
+ if (msginfo->folder->prefs && msginfo->folder->prefs->enable_default_account)
+ account = account_find_from_id(msginfo->folder->prefs->default_account);
+
+ /* select the account for the whole folder (IMAP / NNTP) */
+ if (!account)
+ /* FIXME: this is not right, because folder may be nested. we should
+ * ascend the tree until we find a parent with proper account
+ * information */
+ account = msginfo->folder->folder->account;
+
+ /* select account by to: and cc: header if enabled */
+ if (reply_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;
+
+ return account;
+}
SpecialFolderItemType type);
void account_destroy (PrefsAccount *ac_prefs);
+PrefsAccount *account_get_reply_account (MsgInfo *msginfo,
+ gboolean reply_autosel);
#endif /* __ACCOUNT_H__ */
const gchar *body)
{
Compose *compose;
- PrefsAccount *account;
+ PrefsAccount *account = NULL;
PrefsAccount *reply_account;
GtkSText *text;
g_return_if_fail(msginfo != NULL);
g_return_if_fail(msginfo->folder != NULL);
- account = NULL;
- /* select the account set in folderitem's property (if enabled) */
- if (msginfo->folder->prefs && msginfo->folder->prefs->enable_default_account)
- account = account_find_from_id(msginfo->folder->prefs->default_account);
+ account = account_get_reply_account(msginfo, prefs_common.reply_account_autosel);
- /* select the account for the whole folder (IMAP / NNTP) */
- if (!account)
- /* FIXME: this is not right, because folder may be nested. we should
- * ascend the tree until we find a parent with proper account
- * information */
- 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);
if (ignore_replyto && account->protocol == A_NNTP &&
static void tog_searchbar_cb (GtkWidget *w,
gpointer data);
+static void summary_find_answers (SummaryView *summaryview,
+ MsgInfo *msg);
+
static gboolean summary_update_msg (gpointer source, gpointer data);
GtkTargetEntry summary_drag_types[1] =
!MSG_IS_FORWARDED(msginfo->flags)) {
summary_mark_row_as_unread(summaryview, row);
summary_status_show(summaryview);
+ } else if (MSG_IS_REPLIED(msginfo->flags)) {
+ summary_find_answers(summaryview, msginfo);
+ return;
}
break;
case S_COL_LOCKED:
item->threaded = summaryview->threaded;
}
-static gboolean summary_update_msg(gpointer source, gpointer data) {
+static gboolean summary_update_msg(gpointer source, gpointer data)
+{
MsgInfoUpdate *msginfo_update = (MsgInfoUpdate *) source;
SummaryView *summaryview = (SummaryView *)data;
GtkCTreeNode *node;
return FALSE;
}
+static void summary_find_answers (SummaryView *summaryview, MsgInfo *msg)
+{
+ FolderItem *sent_folder = NULL;
+ PrefsAccount *account = NULL;
+ char *buf = NULL;
+ if (msg == NULL || msg->msgid == NULL)
+ return;
+
+ account = account_get_reply_account(msg, prefs_common.reply_account_autosel);
+ if (account == NULL)
+ return;
+ sent_folder = account_get_special_folder
+ (account, F_OUTBOX);
+
+ buf = g_strdup_printf("I %s", msg->msgid);
+
+ /*if (summaryview->folder_item->prefs->save_copy_to_folder)
+ sent_folder = summaryview->folder_item;
+
+ if (sent_folder == NULL && prefs_common.reply_account_autosel)
+ sent_folder = account_get_special_folder(
+ account_find_from_address(msg->to), F_OUTBOX);
+
+ if (sent_folder == NULL)
+ sent_folder = account_get_special_folder(
+ summaryview->folder_item->folder->account, F_OUTBOX);
+
+ if (sent_folder == NULL) {
+ debug_print("Can't find outgoing folder :(\n");
+ return;
+ }*/
+
+ if (sent_folder != summaryview->folder_item) {
+ folderview_select(summaryview->mainwin->folderview, sent_folder);
+ }
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(summaryview->toggle_search), TRUE);
+ gtk_entry_set_text(GTK_ENTRY(summaryview->search_string), buf);
+ g_free(buf);
+ summary_show(summaryview, summaryview->folder_item);
+}