You are here

function drush_mail_signature in Mail signature 7

Callback to drush command.

File

./mail_signature.drush.inc, line 42
Drush integration with Mail signature module.

Code

function drush_mail_signature($action) {
  if ($action != 'enable' && $action != 'disable') {
    drush_set_error('You have to use only \'enable\' or \'disable\' arguments');
  }
  else {
    switch ($action) {
      case 'enable':
        if (variable_get('mail_signature_text') == '') {
          drush_set_error('Signature is empty, please first add it');
        }
        else {
          variable_set('mail_signature_enabled', TRUE);
          drush_log('Mail signature is now enabled', 'ok');
          if (substr(variable_get('mail_signature_text'), 0, 2) == '--') {
            drush_log('The signature starts with \'--\', please check it!', 'warning');
          }
        }
        break;
      case 'disable':
        variable_set('mail_signature_enabled', FALSE);
        drush_log('Mail signature is now disabled', 'ok');
        break;
    }
  }
}