Skip to content

Commit

Permalink
v0.1.3-build-00611A
Browse files Browse the repository at this point in the history
added an option to select wether to notify for non-Talk notifications or not.
  • Loading branch information
fds2610 committed Jun 11, 2020
1 parent 22feba5 commit 656dd79
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 11 deletions.
7 changes: 7 additions & 0 deletions configWindow.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ <h3>check your options</h3>
default to NC-Talk instead of base URL
</label>
</li>
<li>
<label>
<input type="checkbox" name="option" value="nontalk" onchange="changeOpt(this.name,this.value,this.checked);">
limit notifications to Nextcloud Talk only
</label>
</li>
<li>
<label>
<input type="checkbox" name="option" value="debug" onchange="changeOpt(this.name,this.value,this.checked);">
Expand All @@ -101,6 +107,7 @@ <h3>check your options</h3>
if (x[i].value == 'debug' && CV[1] == 'true') { x[i].checked = true ; }
if (x[i].value == 'browser' && CV[2] == 'true') { x[i].checked = true ; }
if (x[i].value == 'base-url' && CV[3] == 'true') { x[i].checked = true ; }
if (x[i].value == 'nontalk' && CV[4] == 'true') { x[i].checked = true ; }
}

//document.getElementById('ncuser').value = atob(CV[1]);
Expand Down
47 changes: 38 additions & 9 deletions nct.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var notify;
var jd;

let ipc = electron.ipcMain;
var ncurl="", ncuser="", ncpwd=""; ncoption=""; ncbrowser=""; ncbaseurl="";
var ncurl="", ncuser="", ncpwd=""; ncoption=""; ncbrowser=""; ncbaseurl=""; nontalk=false;
var dataarr, werte;
var iconPath = path.join(__dirname, 'Nextcloud.ico');
var APQUIT = 0;
Expand Down Expand Up @@ -138,7 +138,7 @@ ipc.on('initXXXConfigValues', (event, arg) => {
// initServerUrl
ipc.on('initServerUrl', (event, arg) => {
console.log(arg);
werte = ncurl+":"+DEBUG+":"+ncbrowser+":"+ncbaseurl;
werte = ncurl+":"+DEBUG+":"+ncbrowser+":"+ncbaseurl+":"+nontalk;
// werte = werte.concat(ncurl,"\n",ncuser,"\n",ncpwd);
console.log("Werte: "+werte);
event.returnValue = werte;
Expand Down Expand Up @@ -177,6 +177,10 @@ function splitMyData(datastring) {
case 'ncpwd':
ncpwd = keys[1];
break;
case 'nontalk':
nontalk = (keys[1] == 'true') ? true:false;
ncoption = ncoption+keys[0]+':'+keys[1]+"\n";
break;
case 'debug':
DEBUG = (keys[1] == 'true') ? true:false;
ncoption = ncoption+keys[0]+':'+keys[1]+"\n";
Expand All @@ -192,6 +196,7 @@ function splitMyData(datastring) {
ncoption = ncoption+keys[0]+':'+keys[1]+"\n";
break;
}
if(DEBUG) { console.log("Options read from config.ini: "+ncoption);}
}

function openConfigWindow() {
Expand Down Expand Up @@ -578,7 +583,23 @@ function getXMLnotifications(pollResponse) {
}
}
} else {
if(DEBUG && getLines) { console.debug("newNot: "+newNot+" al: "+al); }
if(getLines==1) {
if(al.search("<app>") >= 0) {
let mNontalk = al.slice(al.search(">")+1,-6);
if(DEBUG) { console.log("App: " + mNontalk + " nontalk: " + nontalk); }
if(mNontalk != "spreed") {
if(nontalk) {
getLines = 0;
newNot = 0;
} else {
mSub = "Nachricht von Nextcloud " + mNontalk;
mMsg = "ID: " +nID;
mLink = "";
getLines = 0;
}
}
}
if(al.search("<subject>") >= 0) {
mSub=al.slice(al.search(">")+1,-10);
//console.log("Sub: " + mSub);
Expand All @@ -604,6 +625,10 @@ function getXMLnotifications(pollResponse) {
}

function fireBalloon(subject, message, link) {
if(DEBUG) { console.log('Fkt: fireBalloon()'); }
if(DEBUG) { console.log("sub: "+subject+" msg: "+message);}
let clickit = false;
if (subject.search("NCT Poll-Error") >= 0) { clickit = true; }
if(process.platform == "win32") {
newNot = 0;
console.log("Balloon fired. ");
Expand All @@ -612,13 +637,17 @@ function fireBalloon(subject, message, link) {
trayBalloonOptions.content=message; // +"\n"+mLink;
trayBalloonOptions.icon=iconPath;
tray.displayBalloon(trayBalloonOptions);
tray.on('balloon-click', function() {
//tray.removeBalloon();
console.log("Clicked the Balloon...");
tray.destroy();
sendToTray("green");
createTalkWindow(link);
});
if(clickit) {
tray.on('balloon-click', function() {
//tray.removeBalloon();
console.log("Clicked the Balloon...");
tray.destroy();
sendToTray("green");
createTalkWindow(link);
});
} else {
sendToTray("blue");
}
tray.on('balloon-closed', function() {
//tray.removeBalloon();
console.log("Balloon closed...");
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "nct-desktop",
"version": "0.1.1",
"tag": "v0.1.1",
"version": "0.1.3-build-00611A",
"productName": "NCT Notifier",
"description": "Nextcloud Talk System Tray 4 Windows",
"main": "nct.js",
Expand Down

0 comments on commit 656dd79

Please sign in to comment.