Esempio n. 1
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));
}
Esempio n. 2
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));
}