X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=r3-netstatus%2Fmain.go;h=cd0f601750f83fa497dd58eb69eedd090471af0c;hb=f360a8eb6c27cc69b015b547a418d35d4db54741;hp=8e6610dff2bec6c0a11c4c8ea0ba2c3a8490fd4d;hpb=7a1d5c204fd7670740daa7fad05958a1266cb50a;p=svn42.git diff --git a/r3-netstatus/main.go b/r3-netstatus/main.go index 8e6610d..cd0f601 100644 --- a/r3-netstatus/main.go +++ b/r3-netstatus/main.go @@ -46,7 +46,7 @@ func composeMessage(present, locked, shut bool, who string, ts int64) string { IfThenElseStr(present, "Somebody is present!" , "Everybody left."), IfThenElseStr(locked, "locked","unlocked"), IfThenElseStr(shut, "shut","ajar"), - IfThenElseStr(who == "","", " by " + who), + IfThenElseStr(len(who) == 0,"", " by " + who), time.Unix(ts,0).String()) } @@ -62,7 +62,11 @@ func EventToXMPP(ps *pubsub.PubSub, xmpp_presence_events_chan_ chan <- interface present = event.Present xmpp_presence_events_chan_ <- r3xmppbot.XMPPMsgEvent{Msg: composeMessage(present, locked, shut, who, event.Ts), DistributeLevel: r3xmppbot.R3OnlineOnlyInfo, RememberAsStatus: true} case DoorCommandEvent: - who = event.Who + 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)) case DoorStatusUpdate: locked = event.Locked