+func IfThenElseStr(c bool, strue, sfalse string) string {
+ if c {return strue} else {return sfalse}
+}
+
+func composeMessage(present, locked, shut bool, who string, ts int64) string {
+ return fmt.Sprintf("%s (Door is %s and %s and was last used by %s at %s)",
+ IfThenElseStr(present, "Somebody is present!" , "Everybody left."),
+ IfThenElseStr(locked, "locked","unlocked"),
+ IfThenElseStr(shut, "shut","ajar"),
+ who,
+ time.Unix(ts,0).String())
+}
+