--bug, movement, identation
[svn42.git] / r3-netstatus / main.go
index 8851c74..abec0c1 100644 (file)
@@ -10,15 +10,15 @@ import (
 )
 
 type SpaceState struct {
-       present           bool
-       buttonpress_until int64
+    present           bool
+    buttonpress_until int64
     door_locked bool
     door_shut bool
 }
 
 var (
     presence_socket_path_ string
-       xmpp_presence_events_chan_     chan interface{}
+    xmpp_presence_events_chan_     chan interface{}
     xmpp_login_ struct {jid string; pass string}
     xmpp_bot_authstring_ string
     xmpp_state_save_dir_ string
@@ -27,11 +27,11 @@ var (
 //-------
 
 func init() {
-       flag.StringVar(&xmpp_login_.jid, "xjid", "realrauminfo@realraum.at/Tuer", "XMPP Bot Login JID")
-       flag.StringVar(&xmpp_login_.pass, "xpass", "", "XMPP Bot Login Password")
-       flag.StringVar(&xmpp_bot_authstring_, "xbotauth", "", "String that user use to authenticate themselves to the bot")
-       flag.StringVar(&presence_socket_path_,"presencesocket", "/var/run/tuer/presence.socket",  "Path to presence socket")
-       flag.StringVar(&xmpp_state_save_dir_,"xstatedir","/flash/var/lib/r3netstatus/",  "Directory to save XMPP bot state in")
+    flag.StringVar(&xmpp_login_.jid, "xjid", "realrauminfo@realraum.at/Tuer", "XMPP Bot Login JID")
+    flag.StringVar(&xmpp_login_.pass, "xpass", "", "XMPP Bot Login Password")
+    flag.StringVar(&xmpp_bot_authstring_, "xbotauth", "", "String that user use to authenticate themselves to the bot")
+    flag.StringVar(&presence_socket_path_,"presencesocket", "/var/run/tuer/presence.socket",  "Path to presence socket")
+    flag.StringVar(&xmpp_state_save_dir_,"xstatedir","/flash/var/lib/r3netstatus/",  "Directory to save XMPP bot state in")
     flag.Parse()
 }
 
@@ -49,11 +49,11 @@ func EventToXMPP(ps *pubsub.PubSub, xmpp_presence_events_chan_ chan <- interface
                 xmpp_presence_events_chan_ <- r3xmppbot.XMPPPresenceEvent{Present: present, Who: who, DoorLock: locked, DoorShut: shut, Button: false}
             case DoorCommandEvent:
                 who = event.Who
-                xmpp_presence_events_chan_ <- fmt.Sprintln("DoorCommandEvent",event)
+                xmpp_presence_events_chan_ <- fmt.Sprintln("DoorCommand: ",event.Command, "using", event.Using, "by", event.Who, event.Ts)
             case DoorStatusUpdate:
                 locked = event.Locked
                 shut = event.Shut
-                xmpp_presence_events_chan_ <- fmt.Sprintln("DoorStatusUpdate",event)
+                xmpp_presence_events_chan_ <- fmt.Sprintln("DoorStatus locked:",event.Locked, "shut:", event.Shut, event.Ts)
             case ButtonPressUpdate:
                 xmpp_presence_events_chan_ <- r3xmppbot.XMPPPresenceEvent{Present: present, Who: who, DoorLock: locked, DoorShut: shut, Button: true}
         }