case DoorStatusUpdate:
locked = event.Locked
shut = event.Shut
- xmpp_presence_events_chan_ <- fmt.Sprintln("DoorStatus:",r3xmppbot.IfThenElseStr(event.Locked, "locked","unlocked"), r3xmppbot.IfThenElseStr(event.Shut, "shut","ajar"), time.Unix(event.Ts,0))
+ xmpp_presence_events_chan_ <- r3xmppbot.XMPPPresenceEvent{Present: present, Who: who, DoorLock: locked, DoorShut: shut, Ts: event.Ts}
case ButtonPressUpdate:
xmpp_presence_events_chan_ <- r3xmppbot.XMPPPresenceEvent{Present: present, Who: who, DoorLock: locked, DoorShut: shut, Button: true, Ts: event.Ts}
}
msg = &pec
debug_msg = true
case XMPPPresenceEvent:
+ debug_msg = last_presence_event != nil && last_presence_event.Present == pec.Present
last_presence_event = &pec
msg = composeMessage(last_presence_event, false)
default:
var (
re_presence_ *regexp.Regexp = regexp.MustCompile("Presence: (yes|no)(?:, (opened|closed), (.+))?")
re_status_ *regexp.Regexp = regexp.MustCompile("Status: (closed|opened), (opening|waiting|closing|idle), (ajar|shut).*")
- re_command_ *regexp.Regexp = regexp.MustCompile("(open|close|toggle) (?:(Card|Phone) )?(.+)")
+ re_command_ *regexp.Regexp = regexp.MustCompile("(open|close|toggle) (?:(Card|Phone|SSH|ssh) )?(.+)")
re_button_ *regexp.Regexp = regexp.MustCompile("PanicButton|button\\d?")
re_temp_ *regexp.Regexp = regexp.MustCompile("temp0: (\\d+\\.\\d+)")
re_photo_ *regexp.Regexp = regexp.MustCompile("photo0: (\\d+)")