From cd7b30c04615b0ac24fd70703362698e65aea927 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Tue, 3 Sep 2013 12:40:17 +0000 Subject: [PATCH] bugfix --- r3-netstatus/main.go | 2 +- r3-netstatus/r3xmppbot/r3xmppbot.go | 1 + r3-netstatus/sockettoevent.go | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/r3-netstatus/main.go b/r3-netstatus/main.go index da21016..3e6290a 100644 --- a/r3-netstatus/main.go +++ b/r3-netstatus/main.go @@ -53,7 +53,7 @@ func EventToXMPP(ps *pubsub.PubSub, xmpp_presence_events_chan_ chan <- interface 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} } diff --git a/r3-netstatus/r3xmppbot/r3xmppbot.go b/r3-netstatus/r3xmppbot/r3xmppbot.go index 6017c3a..7a19c77 100644 --- a/r3-netstatus/r3xmppbot/r3xmppbot.go +++ b/r3-netstatus/r3xmppbot/r3xmppbot.go @@ -196,6 +196,7 @@ func (botdata *XmppBot) handleEventsforXMPP(xmppout chan <- xmpp.Stanza, presenc 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: diff --git a/r3-netstatus/sockettoevent.go b/r3-netstatus/sockettoevent.go index c49ad6f..f356482 100644 --- a/r3-netstatus/sockettoevent.go +++ b/r3-netstatus/sockettoevent.go @@ -13,7 +13,7 @@ import ( 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+)") -- 1.7.10.4