+func composeMessage(pec *XMPPPresenceEvent, both bool) *string {
+ var msg string
+ msg = ""
+ if pec.Button {
+ msg = "The button has been pressed ! Propably someone is bored and in need of company ! ;-)"
+ if both { msg += "\n"; } else {
+ msg += " --- " + time.Unix(pec.Ts,0).String()
+ return &msg;
+ }
+ }
+ msg += fmt.Sprintf("%s (Door is %s and %s and was last used by %s at %s)",
+ IfThenElseStr(pec.Present, "Somebody is present!" , "Everybody left."),
+ IfThenElseStr(pec.DoorLock, "locked","unlocked"),
+ IfThenElseStr(pec.DoorShut, "shut","ajar"),
+ pec.Who,
+ time.Unix(pec.Ts,0).String())
+ return &msg
+}
+