Permalink
Browse files

Added better documentation, updated changelog, added TLS option in de…

…mo.js
  • Loading branch information...
1 parent 2818877 commit 7d3c7daed0612f0239a74cafb119fc0418725fd8 @ditesh committed Feb 13, 2013
Showing with 37 additions and 15 deletions.
  1. +7 −1 CHANGELOG
  2. +19 −1 README.md
  3. +11 −13 demos/demo.js
View
8 CHANGELOG
@@ -1,6 +1,12 @@
+0.1.5 (Wed Feb 13 19:05:40 MYT 2013)
+
+ * Fixed issue #4 (thanks to [https://github.com/AVBelyy] )
+ * Fixed issue #3 (replaced references to hashlib with inbuilt crypto)
+ * Better documentation, including
+
0.1.4 (Tue Nov 8 11:30:36 MYT 2011):
- * Fixed issue #1 (thanks to Nazar [http://github.com/nazar] )
+ * Fixed issue #1 (thanks to Nazar [https://github.com/nazar] )
* Removed unused files
* Fixed demo/demo.js
* Fixed bug for non-match on multiline response when -ERR is received
View
20 README.md
@@ -25,7 +25,25 @@ You have two installation options:
1. Download the source and install it yourself
-## Usage
+## Quick demo
+
+Connect to GMail's POP3 servers using the provided demo script as follows:
+
+````bash
+$ node demos/demo.js --host pop.gmail.com --port 995 --username user@gmail.com --password potato --tls on --debug on --networkdebug on
+Server: '+OK Gpop ready for requests from 1.2.3.4 bh7pf61475604pab.24\r\n'
+CONNECT success
+Client: 'USER user@gmail.com\r\n'
+Server: '+OK send PASS\r\n'
+Client: 'PASS potato\r\n'
+Server: '-ERR [AUTH] Username and password not accepted.\r\n'
+LOGIN/PASS failed
+Client: 'QUIT\r\n'
+Server: '+OK Farewell.\r\n'
+QUIT success
+````
+
+## Detailed Usage
node-poplib is event based. It is best to illustrate via examples:
View
24 demos/demo.js
@@ -27,21 +27,21 @@
var util = require("util");
var POP3Client = require("../main.js");
var argv = require('optimist')
- .usage("Usage: $0 --host [host] --port [port] --username [username] --password [password] --debug [on/off] --networkdebug [on/off] --msgnumber [number]")
+ .usage("Usage: $0 --host [host] --port [port] --username [username] --password [password] --tls [on/off] --debug [on/off] --networkdebug [on/off] --msgnumber [number]")
.demand(['username', 'password'])
.argv;
var host = argv.host || "localhost";
var port = argv.port || 110;
var debug = argv.debug === "on" ? true : false;
+var enabletls = argv.tls === "on" ? true : false;
var msgnumber = argv.msgnumber;
var username = argv.username;
var password = argv.password;
var client = new POP3Client(port, host, {
-
- debug: (argv.networkdebug === "on" ? true: false)
-
+ debug: debug,
+ enabletls: enabletls
});
client.on("error", function(err) {
@@ -89,7 +89,7 @@ client.on("capa", function(status, data, rawdata) {
if (status) {
console.log("CAPA success");
- if (debug) console.log(" Parsed data: " + util.inspect(data));
+ if (debug) console.log("Parsed data: " + util.inspect(data));
client.noop();
} else {
@@ -124,7 +124,7 @@ client.on("stat", function(status, data, rawdata) {
if (status === true) {
console.log("STAT success");
- if (debug) console.log(" Parsed data: " + util.inspect(data));
+ if (debug) console.log("Parsed data: " + util.inspect(data));
client.list();
} else {
@@ -162,7 +162,7 @@ client.on("uidl", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("UIDL success");
- if (debug) console.log(" Parsed data: " + data);
+ if (debug) console.log("Parsed data: " + data);
client.top(123123, 10);
} else {
@@ -179,7 +179,7 @@ client.on("top", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("TOP success for msgnumber " + msgnumber);
- if (debug) console.log(" Parsed data: " + data);
+ if (debug) console.log("Parsed data: " + data);
client.retr(msgnumber);
} else {
@@ -195,12 +195,10 @@ client.on("retr", function(status, msgnumber, data, rawdata) {
if (status === true) {
console.log("RETR success for msgnumber " + msgnumber);
- if (debug) console.log(" Parsed data: " + data);
+ if (debug) console.log("Parsed data: " + data);
- if (msgnumber !== undefined)
- client.dele(msgnumber);
- else
- client.quit();
+ if (msgnumber !== undefined) client.dele(msgnumber);
+ else client.quit();
} else {

0 comments on commit 7d3c7da

Please sign in to comment.