Permalink
Browse files

update

  • Loading branch information...
andris9 committed Dec 19, 2012
1 parent af50865 commit b1ef49f8cb3182772313cef82b099edc48898902
Showing 724 changed files with 299,858 additions and 152 deletions.
View
@@ -8,7 +8,7 @@ The demo server (pop3_server.js) currently sends the same message with every req
Secured connections
----------
-**N3** supports both unencrypted connections on port 110 and encrypted TLS connections on port 995. STARTTLS encryption support for port 110 is also supported. See pop3_server.js for examples.
+**N3** supports both unencrypted connections on port 110. See pop3_server.js for examples.
Authentication
--------------
@@ -52,25 +52,15 @@ See *sasl.js* for more complex examples - *PLAIN* and *CRAM-MD5* (*APOP* and *US
Usage
-------
-1. To use the server you need to create certificate files for TLS secure connections. Create privatekey.pem and certificate.pem with
-
- openssl genrsa -out privatekey.pem 1024
- openssl req -new -key privatekey.pem -out certrequest.csr
- openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem
-
- There are already example certificate files in "/cert" for a kickstart installation but you should probably still genereate your own.
-
-2. Copy privatekey.pem and certificate.pem to "/cert" (overwrite the sample certificate files)
-
-3. Run *pop3_server.js* and add a POP3 account to your e-mail client pointing to the node.js server. With the demo script usernames don't matter, any name goes, but the password needs to be 12345
+1. Run *pop3_server.js* and add a POP3 account to your e-mail client pointing to the node.js server. With the demo script usernames don't matter, any name goes, but the password needs to be 12345
node pop3_server.js
For example, if you run *pop3_server.js* in *localhost* then the incoming settings should be something like:
protocol: pop3
server: localhost
- port: 110 (or 995 for TLS)
+ port: 110
username: anything_goes
password: 12345
@@ -84,6 +74,4 @@ MIT. If you make any impromevents to the POP3 server code, then it would be nice
NB
-------
-*libssl-dev* package should be installed before building node.js from the source, otherwise crypto and thus TLS might not work
-
-Make sure that port 110 and 995 (-if secure connections are allowed) are open for incoming connections!
+Make sure that port 110 is open for incoming connections!
View
@@ -32,55 +32,55 @@ MessageStore.prototype.addMessage = function(message){
this.size += message.size;
};
-MessageStore.prototype.stat = function(){
- return this.length+" "+this.size;
+MessageStore.prototype.stat = function(callback){
+ callback(null, this.length, this.size);
}
-MessageStore.prototype.list = function(msg){
+MessageStore.prototype.list = function(msg, callback){
var result = [];
if(msg){
if(isNaN(msg) || msg<1 || msg>this.messages.length ||
this.messages[msg-1].deleteFlag)
- return false;
+ callback(null, false);
return msg+" "+this.messages[msg-1].size;
}
for(var i=0, len = this.messages.length;i<len;i++){
if(!this.messages[i].deleteFlag)
result.push((i+1)+" "+this.messages[i].size)
}
- return result;
+ callback(null, result);
}
-MessageStore.prototype.uidl = function(msg){
+MessageStore.prototype.uidl = function(msg, callback){
var result = [];
if(msg){
if(isNaN(msg) || msg<1 || msg>this.messages.length ||
this.messages[msg-1].deleteFlag)
- return false;
- return msg+" "+this.messages[msg-1].uid;
+ callback(null, false);
+ callback(null, msg+" "+this.messages[msg-1].uid);
}
for(var i=0, len = this.messages.length;i<len;i++){
if(!this.messages[i].deleteFlag)
result.push((i+1)+" "+this.messages[i].uid)
}
- return result;
+ callback(null, result);
}
-MessageStore.prototype.retr = function(msg){
+MessageStore.prototype.retr = function(msg, callback){
if(!msg || isNaN(msg) || msg<1 || msg>this.messages.length ||
this.messages[msg-1].deleteFlag)
- return false;
- return this.buildMimeMail(this.messages[msg-1]);
+ return callback(null, false);
+ return callback(null, this.buildMimeMail(this.messages[msg-1]));
}
-MessageStore.prototype.dele = function(msg){
+MessageStore.prototype.dele = function(msg, callback){
if(!msg || isNaN(msg) || msg<1 || msg>this.messages.length ||
this.messages[msg-1].deleteFlag)
- return false;
+ return callback(null, false);
this.messages[msg-1].deleteFlag = true;
this.length--;
this.size -= this.messages[msg-1].size;
- return true;
+ return callback(null, true);
}
MessageStore.prototype.rset = function(){
View
@@ -1,6 +1,6 @@
// see http://github.com/bnoordhuis/node-iconv for more info
-var Iconv = require("../node-iconv/build/default/iconv").Iconv;
+var Iconv = require("iconv").Iconv;
/* mime related functions - encoding/decoding etc*/
/* TODO: Only UTF-8 and Latin1 are allowed with encodeQuotedPrintable */
Oops, something went wrong.

0 comments on commit b1ef49f

Please sign in to comment.