X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=r3-netstatus%2Fmain.go;h=abec0c18d76f20af7118263f6889d507edbc6ef3;hb=39a41339d2ce0cc3bbbe4d270377e4e698631c1e;hp=8851c74385225e097b30aea4cb74a8fd38dcd298;hpb=3532254fdc34a8649a2894e8e746a4bf61947bde;p=svn42.git diff --git a/r3-netstatus/main.go b/r3-netstatus/main.go index 8851c74..abec0c1 100644 --- a/r3-netstatus/main.go +++ b/r3-netstatus/main.go @@ -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} }