bugfix
authorBernhard Tittelbach <xro@realraum.at>
Tue, 3 Sep 2013 12:40:17 +0000 (12:40 +0000)
committerBernhard Tittelbach <xro@realraum.at>
Tue, 3 Sep 2013 12:40:17 +0000 (12:40 +0000)
r3-netstatus/main.go
r3-netstatus/r3xmppbot/r3xmppbot.go
r3-netstatus/sockettoevent.go

index da21016..3e6290a 100644 (file)
@@ -53,7 +53,7 @@ func EventToXMPP(ps *pubsub.PubSub, xmpp_presence_events_chan_ chan <- interface
             case DoorStatusUpdate:
                 locked = event.Locked
                 shut = event.Shut
             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}
         }
             case ButtonPressUpdate:
                 xmpp_presence_events_chan_ <- r3xmppbot.XMPPPresenceEvent{Present: present, Who: who, DoorLock: locked, DoorShut: shut, Button: true, Ts: event.Ts}
         }
index 6017c3a..7a19c77 100644 (file)
@@ -196,6 +196,7 @@ func (botdata *XmppBot) handleEventsforXMPP(xmppout chan <- xmpp.Stanza, presenc
                     msg = &pec
                     debug_msg = true
                 case XMPPPresenceEvent:
                     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:
                     last_presence_event = &pec
                     msg = composeMessage(last_presence_event, false)
                 default:
index c49ad6f..f356482 100644 (file)
@@ -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).*")
 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+)")
        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+)")