xmpp_presence_events_chan_ chan interface{}
xmpp_login_ struct {jid string; pass string}
xmpp_bot_authstring_ string
xmpp_state_save_dir_ string
xmpp_presence_events_chan_ chan interface{}
xmpp_login_ struct {jid string; pass string}
xmpp_bot_authstring_ string
xmpp_state_save_dir_ string
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(&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(&xmpp_state_save_dir_,"xstatedir","/flash/var/lib/r3netstatus/", "Directory to save XMPP bot state in")
flag.StringVar(&xmpp_state_save_dir_,"xstatedir","/flash/var/lib/r3netstatus/", "Directory to save XMPP bot state in")
present_status := r3xmppbot.XMPPStatusEvent{r3xmppbot.ShowOnline,"Somebody is present"}
notpresent_status := r3xmppbot.XMPPStatusEvent{r3xmppbot.ShowNotAvailabe,"Nobody is here"}
button_status := r3xmppbot.XMPPStatusEvent{r3xmppbot.ShowFreeForChat, "The button has been pressed :-)"}
present_status := r3xmppbot.XMPPStatusEvent{r3xmppbot.ShowOnline,"Somebody is present"}
notpresent_status := r3xmppbot.XMPPStatusEvent{r3xmppbot.ShowNotAvailabe,"Nobody is here"}
button_status := r3xmppbot.XMPPStatusEvent{r3xmppbot.ShowFreeForChat, "The button has been pressed :-)"}
present = event.Present
xmpp_presence_events_chan_ <- r3xmppbot.XMPPMsgEvent{Msg: composeMessage(present, locked, shut, who, event.Ts), DistributeLevel: r3xmppbot.R3OnlineOnlyInfo, RememberAsStatus: true}
if present {
xmpp_presence_events_chan_ <- present_status
} else {
xmpp_presence_events_chan_ <- notpresent_status
present = event.Present
xmpp_presence_events_chan_ <- r3xmppbot.XMPPMsgEvent{Msg: composeMessage(present, locked, shut, who, event.Ts), DistributeLevel: r3xmppbot.R3OnlineOnlyInfo, RememberAsStatus: true}
if present {
xmpp_presence_events_chan_ <- present_status
} else {
xmpp_presence_events_chan_ <- notpresent_status
if len(event.Who) > 0 && len(event.Using) > 0 {
who = fmt.Sprintf("%s (%s)",event.Who, event.Using)
} else {
who = event.Who
}
xmpp_presence_events_chan_ <- fmt.Sprintln("DoorCommand:",event.Command, "using", event.Using, "by", event.Who, time.Unix(event.Ts,0))
if len(event.Who) > 0 && len(event.Using) > 0 {
who = fmt.Sprintf("%s (%s)",event.Who, event.Using)
} else {
who = event.Who
}
xmpp_presence_events_chan_ <- fmt.Sprintln("DoorCommand:",event.Command, "using", event.Using, "by", event.Who, time.Unix(event.Ts,0))
+ xmpp_presence_events_chan_ <- r3xmppbot.XMPPMsgEvent{Msg: composeMessage(present, locked, shut, who, event.Ts), DistributeLevel: r3xmppbot.R3DebugInfo, RememberAsStatus: true}
+ case r3events.DoorAjarUpdate:
shut = event.Shut
xmpp_presence_events_chan_ <- r3xmppbot.XMPPMsgEvent{Msg: composeMessage(present, locked, shut, who, event.Ts), DistributeLevel: r3xmppbot.R3DebugInfo, RememberAsStatus: true}
shut = event.Shut
xmpp_presence_events_chan_ <- r3xmppbot.XMPPMsgEvent{Msg: composeMessage(present, locked, shut, who, event.Ts), DistributeLevel: r3xmppbot.R3DebugInfo, RememberAsStatus: true}
xmpp_presence_events_chan_ <- r3xmppbot.XMPPMsgEvent{Msg: button_msg, DistributeLevel: r3xmppbot.R3OnlineOnlyInfo}
xmpp_presence_events_chan_ <- button_status
last_buttonpress = event.Ts
xmpp_presence_events_chan_ <- r3xmppbot.XMPPMsgEvent{Msg: button_msg, DistributeLevel: r3xmppbot.R3OnlineOnlyInfo}
xmpp_presence_events_chan_ <- button_status
last_buttonpress = event.Ts
if present && last_buttonpress > 0 && time.Now().Unix() - last_buttonpress > button_press_timeout_ {
xmpp_presence_events_chan_ <- present_status
last_buttonpress = 0
if present && last_buttonpress > 0 && time.Now().Unix() - last_buttonpress > button_press_timeout_ {
xmpp_presence_events_chan_ <- present_status
last_buttonpress = 0
var xmpperr error
var bot *r3xmppbot.XmppBot
bot, xmpp_presence_events_chan_, xmpperr = r3xmppbot.NewStartedBot(xmpp_login_.jid, xmpp_login_.pass, xmpp_bot_authstring_, xmpp_state_save_dir_, true)
var xmpperr error
var bot *r3xmppbot.XmppBot
bot, xmpp_presence_events_chan_, xmpperr = r3xmppbot.NewStartedBot(xmpp_login_.jid, xmpp_login_.pass, xmpp_bot_authstring_, xmpp_state_save_dir_, true)
- case e := <-newlinequeue:
- ParseSocketInputLine(e, ps) //, brn)
+ case e := <-zmqsub.In():
+ ParseZMQr3Event(e, ps) //, brn)