diff --git a/node/notification.js b/node/notification.js deleted file mode 100644 index ed515a2..0000000 --- a/node/notification.js +++ /dev/null @@ -1,47 +0,0 @@ -var notifier = require('node-notifier'); -var path = require('path'); - -var Notification = function () { - - var laststate = false; - - this.notificate = function (currentstate) { - - notifier.on('click', function (notifierObject, options) { - // Happens if `wait: true` and user clicks notification - }); - - notifier.on('timeout', function (notifierObject, options) { - // Happens if `wait: true` and notification closes - }); - - if (currentstate === true && laststate != true) { - laststate = true; - notifier.notify({ - title: 'CTDO - Status', - message: 'Der Chaostreff Dortmund ist nun offen.', - icon: path.join('public/img/green.png'), // absolute path (not balloons) - sound: true, // Only Notification Center or Windows Toasters - wait: true // wait with callback until user action is taken on notification - }, function (err, response) { - // response is response from notification - }); - //console.log("State changed to Open"); - } else if (currentstate == false && laststate != false) { - laststate = false; - notifier.notify({ - title: 'CTDO - Status', - message: 'Der Chaostreff Dortmund ist nun geschlossen.', - icon: path.join('public/img/red.png'), // absolute path (not balloons) - sound: true, // Only Notification Center or Windows Toasters - wait: true // wait with callback until user action is taken on notification - }, function (err, response) { - // response is response from notification - }); - //console.log("State changed to Close"); - } - //console.log("Currentstate: " + currentstate + " Laststate: " + laststate); - }; -}; - -module.exports = Notification; diff --git a/node/statusbot.js b/node/statusbot.js index 232464b..ecaf820 100644 --- a/node/statusbot.js +++ b/node/statusbot.js @@ -1,13 +1,11 @@ var express = require('express'), app = express(), server = require('http').createServer(app), - io = require('socket.io').listen(server)/*,*/; - //notifier = require('node-notifier'); + io = require('socket.io').listen(server); var flash = require('connect-flash'); var moment = require('moment'); var SnmpMac = require("./snmp-mac"); var IpPoll = require("./ip-poll"); -var Notification = require("./notification"); var Flukso = require("./flukso"); var routes = require("./routes"); var path = require('path'); @@ -59,7 +57,6 @@ var usercountanswer = {at: 0, current_value: 0, datapoints: [ var snmpMac = new SnmpMac("juni.ctdo.de", "ctdo23"); var ippoll = new IpPoll("switch2.raum.ctdo.de", "195.160.169.30-120"); var flukso = new Flukso("flukso.raum.ctdo.de", "/sensor/cf00e0b22230f4a8870af58f2b8719dd"); -//var notification = new Notification(); var port = '3000'; var address = 'localhost'; @@ -96,7 +93,6 @@ io.configure(function () { function work() { snmpMac.poll(); ippoll.pollCount(); - //notification.notificate(simpleanswer.state); } setInterval(work, 60000); diff --git a/node/views/index.jade b/node/views/index.jade index 8a02019..4cc6344 100644 --- a/node/views/index.jade +++ b/node/views/index.jade @@ -60,5 +60,4 @@ block scripts script(type="text/javascript",src="/js/vendor/justgage.1.0.1.min.js") script(type="text/javascript",src="/js/vendor/cheet.min.js") script(type="text/javascript",src="/js/vendor/notification.js") - script(type="text/javascript",src="/js/state-notify.js") script(type="text/javascript",src="/js/easter.js")