From 986e962a5afbec18bbecdf6fc50eefa437642c9d Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Wed, 27 Mar 2013 17:15:40 +0000 Subject: [PATCH] spaceapi update to 0.13 as OpenSpaceLint understands 0.13 --- r3-webstatus-spaceapi/main.go | 2 +- r3-webstatus-spaceapi/spaceapi/spaceapi.go | 35 +++++++++++++++++++++------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/r3-webstatus-spaceapi/main.go b/r3-webstatus-spaceapi/main.go index 28c094b..07bb194 100644 --- a/r3-webstatus-spaceapi/main.go +++ b/r3-webstatus-spaceapi/main.go @@ -118,7 +118,7 @@ ReOpenSocket: func main() { spaceapidata.AddSpaceFeed("calendar", "application/rss+xml", "http://grical.realraum.at/s/?query=!realraum&view=rss") spaceapidata.AddSpaceFeed("google+", "text/html", "https://plus.google.com/113737596421797426873") - spaceapidata.AddSpaceContactInfo("+43780700888524", "irc://irc.oftc.net/#realraum", "realraum@realraum.at", "realraum@realraum.at", "realraum@realraum.at") + spaceapidata.AddSpaceContactInfo("+43780700888524", "irc://irc.oftc.net/#realraum", "realraum@realraum.at", "realraum@realraum.at", "realraum@realraum.at", "vorstand@realraum.at") eventqueue := make(chan string) ticker := time.NewTicker(time.Duration(15) * time.Minute) go readFromUSocket("/var/run/tuer/presence.socket", eventqueue) diff --git a/r3-webstatus-spaceapi/spaceapi/spaceapi.go b/r3-webstatus-spaceapi/spaceapi/spaceapi.go index 3a0f828..9455e84 100644 --- a/r3-webstatus-spaceapi/spaceapi/spaceapi.go +++ b/r3-webstatus-spaceapi/spaceapi/spaceapi.go @@ -37,12 +37,14 @@ func (nsi SpaceInfo) UpdateSensorData(what, where, value string) { } } -func (nsi SpaceInfo) AddSpaceContactInfo(phone, irc, email, ml, jabber string) SpaceInfo { +func (nsi SpaceInfo) AddSpaceContactInfo(phone, irc, email, ml, jabber, issuemail string) SpaceInfo { nsi["contact"] = SpaceInfo{ "phone": phone, "email": email, "ml": ml, - "jabber": jabber} + "jabber": jabber, + "issue-mail": issuemail} + nsi["issue-report-channels"] = [3]string{"issue-mail","email","ml"} return nsi } @@ -98,6 +100,12 @@ func (nsi SpaceInfo) SetStatus(open bool, status string) { nsi["status"] = status nsi["open"] = open nsi["lastchange"] = time.Now().Unix() + state, ok := nsi["state"].(SpaceInfo) + if ok { + state["message"] = status + state["open"] = open + state["lastchange"] = nsi["lastchange"] + } } func NewSpaceInfo(space string, url string, logo string, open_icon string, closed_icon string, lat float64, lon float64) SpaceInfo { @@ -108,13 +116,22 @@ func NewSpaceInfo(space string, url string, logo string, open_icon string, close "logo": logo, "open": false, "lastchange": time.Now().Unix(), - "icon": SpaceInfo{ - "open": open_icon, - "closed": closed_icon}, - "location": SpaceInfo{ - "lat": lat, - "lon": lon}, - "contact" : SpaceInfo {} } + "icon": SpaceInfo{ + "open": open_icon, + "closed": closed_icon, + }, + "state": SpaceInfo{ + "open": false, + "lastchange":time.Now().Unix(), + "icon": SpaceInfo{ + "open": open_icon, + "closed": closed_icon}, + }, + "location": SpaceInfo{ + "lat": lat, + "lon": lon}, + "contact" : SpaceInfo {}, + } return nsi } -- 1.7.10.4