-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
65 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
// Modules to control application life and create native browser window | ||
const {app, BrowserWindow} = require('electron') | ||
const { app, BrowserWindow } = require('electron') | ||
const path = require('path') | ||
|
||
function createWindow () { | ||
// Create the browser window. | ||
const mainWindow = new BrowserWindow({ | ||
width: 800, | ||
height: 600, | ||
webPreferences: { | ||
preload: path.join(__dirname, 'preload.js') | ||
} | ||
}) | ||
|
||
// and load the index.html of the app. | ||
mainWindow.loadFile('index.html') | ||
|
||
// Open the DevTools. | ||
// mainWindow.webContents.openDevTools() | ||
function createWindow() { | ||
// Create the browser window. | ||
const mainWindow = new BrowserWindow({ | ||
width: 800, | ||
height: 600, | ||
webPreferences: { | ||
preload: path.join(__dirname, 'preload.js') | ||
} | ||
}) | ||
|
||
// and load the index.html of the app. | ||
mainWindow.loadFile('index.html') | ||
|
||
// Open the DevTools. | ||
// mainWindow.webContents.openDevTools() | ||
} | ||
|
||
// This method will be called when Electron has finished | ||
|
@@ -26,15 +26,15 @@ app.whenReady().then(createWindow) | |
|
||
// Quit when all windows are closed. | ||
app.on('window-all-closed', function () { | ||
// On macOS it is common for applications and their menu bar | ||
// to stay active until the user quits explicitly with Cmd + Q | ||
if (process.platform !== 'darwin') app.quit() | ||
// On macOS it is common for applications and their menu bar | ||
// to stay active until the user quits explicitly with Cmd + Q | ||
if (process.platform !== 'darwin') app.quit() | ||
}) | ||
|
||
app.on('activate', function () { | ||
// On macOS it's common to re-create a window in the app when the | ||
// dock icon is clicked and there are no other windows open. | ||
if (BrowserWindow.getAllWindows().length === 0) createWindow() | ||
// On macOS it's common to re-create a window in the app when the | ||
// dock icon is clicked and there are no other windows open. | ||
if (BrowserWindow.getAllWindows().length === 0) createWindow() | ||
}) | ||
|
||
// In this file you can include the rest of your app's specific main process | ||
|
@@ -50,7 +50,7 @@ var client = new pop3Client(995, "server211.webhostingbuzz.com", { | |
}); | ||
console.log("Client Created"); | ||
|
||
client.on("error", function(err) { | ||
client.on("error", function (err) { | ||
|
||
if (err.errno === 111) console.log("Unable to connect to server"); | ||
else console.log("Server error occurred"); | ||
|
@@ -59,90 +59,90 @@ client.on("error", function(err) { | |
|
||
}); | ||
|
||
client.on("connect", function() { | ||
client.on("connect", function () { | ||
|
||
console.log("CONNECT success"); | ||
client.login("[email protected]", "ZF6)RoPb.R"); | ||
|
||
}); | ||
|
||
client.on("invalid-state", function(cmd) { | ||
client.on("invalid-state", function (cmd) { | ||
console.log("Invalid state. You tried calling " + cmd); | ||
}); | ||
|
||
client.on("locked", function(cmd) { | ||
client.on("locked", function (cmd) { | ||
console.log("Current command has not finished yet. You tried calling " + cmd); | ||
}); | ||
|
||
client.on("login", function(status, rawdata) { | ||
client.on("login", function (status, rawdata) { | ||
|
||
if (status) { | ||
if (status) { | ||
|
||
console.log("LOGIN/PASS success"); | ||
client.list(); | ||
console.log("LOGIN/PASS success"); | ||
client.list(); | ||
|
||
} else { | ||
} else { | ||
|
||
console.log("LOGIN/PASS failed"); | ||
client.quit(); | ||
console.log("LOGIN/PASS failed"); | ||
client.quit(); | ||
|
||
} | ||
} | ||
}); | ||
|
||
// Data is a 1-based index of messages, if there are any messages | ||
client.on("list", function(status, msgcount, msgnumber, data, rawdata) { | ||
client.on("list", function (status, msgcount, msgnumber, data, rawdata) { | ||
|
||
if (status === false) { | ||
if (status === false) { | ||
|
||
console.log("LIST failed"); | ||
client.quit(); | ||
console.log("LIST failed"); | ||
client.quit(); | ||
|
||
} else { | ||
} else { | ||
|
||
console.log("LIST success with " + msgcount + " element(s)"); | ||
console.log("LIST success with " + msgcount + " element(s)"); | ||
|
||
if (msgcount > 0) | ||
client.retr(1); | ||
else | ||
client.quit(); | ||
if (msgcount > 0) | ||
client.retr(1); | ||
else | ||
client.quit(); | ||
|
||
} | ||
} | ||
}); | ||
|
||
client.on("retr", function(status, msgnumber, data, rawdata) { | ||
client.on("retr", function (status, msgnumber, data, rawdata) { | ||
|
||
if (status === true) { | ||
if (status === true) { | ||
|
||
console.log("RETR success for msgnumber " + msgnumber); | ||
client.dele(msgnumber); | ||
client.quit(); | ||
console.log("RETR success for msgnumber " + msgnumber); | ||
client.dele(msgnumber); | ||
client.quit(); | ||
|
||
} else { | ||
} else { | ||
|
||
console.log("RETR failed for msgnumber " + msgnumber); | ||
client.quit(); | ||
console.log("RETR failed for msgnumber " + msgnumber); | ||
client.quit(); | ||
|
||
} | ||
} | ||
}); | ||
|
||
client.on("dele", function(status, msgnumber, data, rawdata) { | ||
client.on("dele", function (status, msgnumber, data, rawdata) { | ||
|
||
if (status === true) { | ||
if (status === true) { | ||
|
||
console.log("DELE success for msgnumber " + msgnumber); | ||
client.quit(); | ||
console.log("DELE success for msgnumber " + msgnumber); | ||
client.quit(); | ||
|
||
} else { | ||
} else { | ||
|
||
console.log("DELE failed for msgnumber " + msgnumber); | ||
client.quit(); | ||
console.log("DELE failed for msgnumber " + msgnumber); | ||
client.quit(); | ||
|
||
} | ||
} | ||
}); | ||
|
||
client.on("quit", function(status, rawdata) { | ||
client.on("quit", function (status, rawdata) { | ||
|
||
if (status === true) console.log("QUIT success"); | ||
else console.log("QUIT failed"); | ||
if (status === true) console.log("QUIT success"); | ||
else console.log("QUIT failed"); | ||
|
||
}); |