Example #1
0
static void escape(Mail_T m) {
  // replace bare linefeed
  Util_replaceString(&m->message, "\r\n", "\n");
  Util_replaceString(&m->message, "\n", "\r\n");
  // escape ^.
  Util_replaceString(&m->message, "\n.", "\n..");
  // drop any CR|LF from the subject
  Str_chomp(m->subject);
}
Example #2
0
static void replace_bare_linefeed(Mail_T *m) {
  Util_replaceString(&(*m)->message, "\r\n", "\n");
  Util_replaceString(&(*m)->message, "\n", "\r\n");
}
Example #3
0
static void substitute(Mail_T *m, Event_T e) {
  char timestamp[STRLEN];

  ASSERT(m && e);

  Util_replaceString(&(*m)->from,    "$HOST", Run.localhostname);
  Util_replaceString(&(*m)->subject, "$HOST", Run.localhostname);
  Util_replaceString(&(*m)->message, "$HOST", Run.localhostname);
  
  Util_getRFC822Date((time_t *)&e->collected.tv_sec, timestamp, STRLEN);
  Util_replaceString(&(*m)->subject, "$DATE", timestamp);
  Util_replaceString(&(*m)->message, "$DATE", timestamp);

  Util_replaceString(&(*m)->subject, "$SERVICE", Event_get_source_name(e));
  Util_replaceString(&(*m)->message, "$SERVICE", Event_get_source_name(e));

  Util_replaceString(&(*m)->subject, "$EVENT", Event_get_description(e));
  Util_replaceString(&(*m)->message, "$EVENT", Event_get_description(e));

  Util_replaceString(&(*m)->subject, "$DESCRIPTION", NVLSTR(Event_get_message(e)));
  Util_replaceString(&(*m)->message, "$DESCRIPTION", NVLSTR(Event_get_message(e)));

  Util_replaceString(&(*m)->subject, "$ACTION", Event_get_action_description(e));
  Util_replaceString(&(*m)->message, "$ACTION", Event_get_action_description(e));
}
Example #4
0
static void substitute(Mail_T m, Event_T e) {
  char timestamp[STRLEN];

  ASSERT(m && e);

  Util_replaceString(&m->from,    "$HOST", Run.system->name);
  Util_replaceString(&m->subject, "$HOST", Run.system->name);
  Util_replaceString(&m->message, "$HOST", Run.system->name);

  Time_string(e->collected.tv_sec, timestamp);
  Util_replaceString(&m->subject, "$DATE", timestamp);
  Util_replaceString(&m->message, "$DATE", timestamp);

  Util_replaceString(&m->subject, "$SERVICE", Event_get_source_name(e));
  Util_replaceString(&m->message, "$SERVICE", Event_get_source_name(e));

  Util_replaceString(&m->subject, "$EVENT", Event_get_description(e));
  Util_replaceString(&m->message, "$EVENT", Event_get_description(e));

  Util_replaceString(&m->subject, "$DESCRIPTION", NVLSTR(Event_get_message(e)));
  Util_replaceString(&m->message, "$DESCRIPTION", NVLSTR(Event_get_message(e)));

  Util_replaceString(&m->subject, "$ACTION", Event_get_action_description(e));
  Util_replaceString(&m->message, "$ACTION", Event_get_action_description(e));
}