diff --git a/src/com/fsck/k9/Account.java b/src/com/fsck/k9/Account.java
index 518709566..3ab36790b 100644
--- a/src/com/fsck/k9/Account.java
+++ b/src/com/fsck/k9/Account.java
@@ -44,6 +44,7 @@ public class Account implements BaseAccount
public static final String TYPE_OTHER = "OTHER";
private static String[] networkTypes = { TYPE_WIFI, TYPE_MOBILE, TYPE_OTHER };
+ private static final String DEFAULT_QUOTE_PREFIX = ">";
/**
*
@@ -97,6 +98,7 @@ public class Account implements BaseAccount
// Tracks if we have sent a notification for this account for
// current set of fetched messages
private boolean mRingNotified;
+ private String mQuotePrefix;
private List identities;
@@ -146,6 +148,7 @@ public class Account implements BaseAccount
goToUnreadMessageSearch = false;
subscribedFoldersOnly = false;
maximumPolledMessageAge = 10;
+ mQuotePrefix = DEFAULT_QUOTE_PREFIX;
searchableFolders = Searchable.ALL;
@@ -215,6 +218,7 @@ public class Account implements BaseAccount
false);
maximumPolledMessageAge = preferences.getPreferences().getInt(mUuid
+ ".maximumPolledMessageAge", -1);
+ mQuotePrefix = preferences.getPreferences().getString(mUuid + ".quotePrefix", DEFAULT_QUOTE_PREFIX);
for (String type : networkTypes)
{
Boolean useCompression = preferences.getPreferences().getBoolean(mUuid + ".useCompression." + type,
@@ -386,6 +390,7 @@ public class Account implements BaseAccount
editor.remove(mUuid + ".goToUnreadMessageSearch");
editor.remove(mUuid + ".subscribedFoldersOnly");
editor.remove(mUuid + ".maximumPolledMessageAge");
+ editor.remove(mUuid + ".quotePrefix");
for (String type : networkTypes)
{
editor.remove(mUuid + ".useCompression." + type);
@@ -471,6 +476,7 @@ public class Account implements BaseAccount
editor.putBoolean(mUuid + ".goToUnreadMessageSearch", goToUnreadMessageSearch);
editor.putBoolean(mUuid + ".subscribedFoldersOnly", subscribedFoldersOnly);
editor.putInt(mUuid + ".maximumPolledMessageAge", maximumPolledMessageAge);
+ editor.putString(mUuid + ".quotePrefix", mQuotePrefix);
for (String type : networkTypes)
{
@@ -1242,6 +1248,7 @@ public class Account implements BaseAccount
{
this.maximumPolledMessageAge = maximumPolledMessageAge;
}
+
public Date getEarliestPollDate()
{
int age = getMaximumPolledMessageAge();
@@ -1282,4 +1289,14 @@ public class Account implements BaseAccount
return null;
}
}
+
+ public String getQuotePrefix()
+ {
+ return mQuotePrefix;
+ }
+
+ public void setQuotePrefix(String quotePrefix)
+ {
+ mQuotePrefix = quotePrefix;
+ }
}
diff --git a/src/com/fsck/k9/activity/MessageCompose.java b/src/com/fsck/k9/activity/MessageCompose.java
index c26360819..977192727 100644
--- a/src/com/fsck/k9/activity/MessageCompose.java
+++ b/src/com/fsck/k9/activity/MessageCompose.java
@@ -1343,7 +1343,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
getString(R.string.message_compose_reply_header_fmt),
Address.toString(mSourceMessage.getFrom()));
- quotedText += MimeUtility.getTextFromPart(part).replaceAll("(?m)^", ">");
+ final String prefix = mAccount.getQuotePrefix();
+ // "$" and "\" in the quote prefix have to be escaped for
+ // the replaceAll() invocation.
+ final String escapedPrefix = prefix.replaceAll("(\\\\|\\$)", "\\\\$1");
+ quotedText += MimeUtility.getTextFromPart(part).replaceAll(
+ "(?m)^", escapedPrefix);
+
quotedText = quotedText.replaceAll("\\\r", "");
mQuotedText.setText(quotedText);
diff --git a/src/com/fsck/k9/activity/setup/AccountSettings.java b/src/com/fsck/k9/activity/setup/AccountSettings.java
index ff53b276b..e3505f38d 100644
--- a/src/com/fsck/k9/activity/setup/AccountSettings.java
+++ b/src/com/fsck/k9/activity/setup/AccountSettings.java
@@ -53,7 +53,7 @@ public class AccountSettings extends K9PreferenceActivity
private static final String PREFERENCE_LED_COLOR = "led_color";
private static final String PREFERENCE_NOTIFICATION_OPENS_UNREAD = "notification_opens_unread";
private static final String PREFERENCE_MESSAGE_AGE = "account_message_age";
-
+ private static final String PREFERENCE_QUOTE_PREFIX = "account_quote_prefix";
private Account mAccount;
@@ -81,6 +81,7 @@ public class AccountSettings extends K9PreferenceActivity
private Preference mLedColor;
private boolean mIncomingChanged = false;
private CheckBoxPreference mNotificationOpensUnread;
+ private EditTextPreference mAccountQuotePrefix;
public static void actionSettings(Context context, Account account)
@@ -131,6 +132,20 @@ public class AccountSettings extends K9PreferenceActivity
}
});
+ mAccountQuotePrefix = (EditTextPreference) findPreference(PREFERENCE_QUOTE_PREFIX);
+ mAccountQuotePrefix.setSummary(mAccount.getQuotePrefix());
+ mAccountQuotePrefix.setText(mAccount.getQuotePrefix());
+ mAccountQuotePrefix.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
+ {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue)
+ {
+ final String value = newValue.toString();
+ mAccountQuotePrefix.setSummary(value);
+ mAccountQuotePrefix.setText(value);
+ return false;
+ }
+ });
mCheckFrequency = (ListPreference) findPreference(PREFERENCE_FREQUENCY);
mCheckFrequency.setValue(String.valueOf(mAccount.getAutomaticCheckIntervalMinutes()));
@@ -441,6 +456,7 @@ public class AccountSettings extends K9PreferenceActivity
mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue()));
mAccount.setExpungePolicy(mExpungePolicy.getValue());
mAccount.setSearchableFolders(Account.Searchable.valueOf(mSearchableFolders.getValue()));
+ mAccount.setQuotePrefix(mAccountQuotePrefix.getText());
boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
needsRefresh |= mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue()));