--bug regex
[svn42.git] / r3-netstatus / sockettoevent.go
index 405dbbf..e1f3379 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).*")
-       re_command_     *regexp.Regexp     = regexp.MustCompile("(open|close|toggle) (?:(Card|Phone) )?(.+)")
+       re_command_     *regexp.Regexp     = regexp.MustCompile("(open|close|toggle|reset)(?: +(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+)")
@@ -76,6 +76,7 @@ func ParseSocketInputLine(line string, ps *pubsub.PubSub) { //, brn *brain.Brain
     var tidbit interface{}
     ts := time.Now().Unix()
     if match_presence != nil {
+        if match_presence[2] != "" { ps.Pub(DoorStatusUpdate{match_presence[2] == "closed", true, ts}, "door"); }
         tidbit = PresenceUpdate{match_presence[1] == "yes", ts}
         //~ brn.Oboite("presence", tidbit)
         ps.Pub(tidbit, "presence")