]> granicus.if.org Git - icinga2/commitdiff
Implement CONTACTEMAIL and CONTACTPAGER macros.
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 30 Aug 2013 13:16:25 +0000 (15:16 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 30 Aug 2013 13:16:25 +0000 (15:16 +0200)
lib/icinga/user.cpp

index 649792422d94e5d4c76bc150cf8ff62fcb7a65ff..2cda97928362974c266654ba5b4727496f25d834 100644 (file)
@@ -128,10 +128,19 @@ bool User::ResolveMacro(const String& macro, const Dictionary::Ptr&, String *res
                *result = GetDisplayName();
                return true;
        } else {
+               String tmacro;
+
+               if (macro == "CONTACTEMAIL")
+                       tmacro = "email";
+               else if (macro == "CONTACTPAGER")
+                       tmacro = "pager";
+               else
+                       tmacro = macro;
+
                Dictionary::Ptr macros = GetMacros();
 
-               if (macros && macros->Contains(macro)) {
-                       *result = macros->Get(macro);
+               if (macros && macros->Contains(tmacro)) {
+                       *result = macros->Get(tmacro);
                        return true;
                }