Skip to content

Commit

Permalink
Added config option add_sig_dashes.
Browse files Browse the repository at this point in the history
ner now doesn't unconditionally prepend the sig dashes before the user's
signature.

Signed-off-by: Tilman Sauerbeck <tilman@code-monkey.de>
  • Loading branch information
tilman2 authored and michaelforney committed Jan 25, 2011
1 parent c0af706 commit b036747
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions ner.yaml.sample
Expand Up @@ -6,6 +6,7 @@
general:
sort_mode: newest_first
refresh_view: true
add_sig_dashes: true

commands:
send: /usr/sbin/sendmail -t
Expand Down
7 changes: 6 additions & 1 deletion src/compose_view.cc
Expand Up @@ -24,6 +24,7 @@

#include "compose_view.hh"
#include "notmuch.hh"
#include "ner_config.hh"

ComposeView::ComposeView(const View::Geometry & geometry)
: EmailEditView(geometry)
Expand All @@ -48,7 +49,11 @@ ComposeView::ComposeView(const View::Geometry & geometry)
/* Read the user's signature */
if (!_identity->signaturePath.empty())
{
messageContentStream << std::endl << "-- " << std::endl;
if (NerConfig::instance().addSigDashes())
messageContentStream << std::endl << "-- ";

messageContentStream << std::endl;

std::ifstream signatureFile(_identity->signaturePath.c_str());
messageContentStream << signatureFile.rdbuf();
}
Expand Down
11 changes: 11 additions & 0 deletions src/ner_config.cc
Expand Up @@ -81,6 +81,7 @@ void NerConfig::load()
{
_sortMode = NOTMUCH_SORT_NEWEST_FIRST;
_refreshView = true;
_addSigDashes = true;
_commands.clear();

std::string configPath(std::string(getenv("HOME")) + "/" + nerConfigFile);
Expand Down Expand Up @@ -124,6 +125,11 @@ void NerConfig::load()

if (refreshViewNode)
*refreshViewNode >> _refreshView;

auto addSigDashesNode = general->FindValue("add_sig_dashes");

if (addSigDashesNode)
*addSigDashesNode >> _addSigDashes;
}

/* Commands */
Expand Down Expand Up @@ -277,5 +283,10 @@ bool NerConfig::refreshView() const
return _refreshView;
}

bool NerConfig::addSigDashes() const
{
return _addSigDashes;
}

// vim: fdm=syntax fo=croql et sw=4 sts=4 ts=8

3 changes: 3 additions & 0 deletions src/ner_config.hh
Expand Up @@ -41,6 +41,8 @@ class NerConfig

bool refreshView() const;

bool addSigDashes() const;

private:
NerConfig();
~NerConfig();
Expand All @@ -49,6 +51,7 @@ class NerConfig
std::vector<Search> _searches;
notmuch_sort_t _sortMode;
bool _refreshView;
bool _addSigDashes;
};

#endif
Expand Down
6 changes: 5 additions & 1 deletion src/reply_view.cc
Expand Up @@ -155,7 +155,11 @@ ReplyView::ReplyView(const std::string & messageId, const View::Geometry & geome
/* Read user's signature */
if (!_identity->signaturePath.empty())
{
messageContentStream << std::endl << "-- " << std::endl;
if (NerConfig::instance().addSigDashes())
messageContentStream << std::endl << "-- ";

messageContentStream << std::endl;

std::ifstream signatureFile(_identity->signaturePath.c_str());
messageContentStream << signatureFile.rdbuf();
}
Expand Down

0 comments on commit b036747

Please sign in to comment.