Skip to content

Commit

Permalink
enforce single code style
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Mar 27, 2015
1 parent 26b4c47 commit 272c50b
Show file tree
Hide file tree
Showing 80 changed files with 3,579 additions and 2,973 deletions.
2 changes: 2 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"undef": true,
"unused": true,
"-W100": true,
"quotmark": "double",
"bitwise": true,

"globals": {
"define": true
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: node_js
node_js:
- 0.8
- "0.10"
- "0.11"
- 0.12
- iojs

before_script:
- npm install -g grunt-cli
Expand Down
10 changes: 3 additions & 7 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ module.exports = function(grunt) {
jshint: {
all: ["Gruntfile.js", "lib/**/*.js", "index.js"],
options: {
"node": true,
"globalstrict": true,
"evil": true,
"unused": true,
"undef": true,
"newcap": true
jshintrc: ".jshintrc"
}
},
nodeunit: {
all: ['tests/*.js']
all: ["tests/*.js"]
}
});

Expand All @@ -27,4 +22,5 @@ module.exports = function(grunt) {

// Default task(s).
grunt.registerTask("default", ["jshint", "nodeunit"]);

};
103 changes: 55 additions & 48 deletions examples/complete.js
Original file line number Diff line number Diff line change
@@ -1,65 +1,72 @@
var hoodiecrow = require("../lib/server"),
server = hoodiecrow({
plugins: ["ID", "STARTTLS"/*, "LOGINDISABLED"*/, "SASL-IR", "AUTH-PLAIN", "NAMESPACE", "IDLE", "ENABLE", "CONDSTORE", "XTOYBIRD", "LITERALPLUS", "UNSELECT", "SPECIAL-USE", "CREATE-SPECIAL-USE"],
id:{
plugins: ["ID", "STARTTLS" /*, "LOGINDISABLED"*/ , "SASL-IR", "AUTH-PLAIN", "NAMESPACE", "IDLE", "ENABLE", "CONDSTORE", "XTOYBIRD", "LITERALPLUS", "UNSELECT", "SPECIAL-USE", "CREATE-SPECIAL-USE"],
id: {
name: "hoodiecrow",
version: "0.1"
},

storage: {
"INBOX":{
messages: [
{raw: "Subject: hello 1\r\n\r\nWorld 1!", internaldate: "14-Sep-2013 21:22:28 -0300"},
{raw: "Subject: hello 2\r\n\r\nWorld 2!", flags: ["\\Seen"]},
{raw: "Subject: hello 3\r\n\r\nWorld 3!"},
{raw: "From: sender name <[email protected]>\r\n"+
"To: Receiver name <[email protected]>\r\n"+
"Subject: hello 4\r\n"+
"Message-Id: <abcde>\r\n"+
"Date: Fri, 13 Sep 2013 15:01:00 +0300\r\n"+
"\r\n"+
"World 4!"},
{raw: "Subject: hello 5\r\n\r\nWorld 5!"},
{raw: "Subject: hello 6\r\n\r\nWorld 6!"}
]
},
"":{
"separator": "/",
"folders":{
"[Gmail]":{
"flags": ["\\Noselect"],
"folders": {
"All Mail":{
"special-use": "\\All"
},
"Drafts":{
"special-use": "\\Drafts"
},
"Important":{
"special-use": "\\Important"
},
"Sent Mail":{
"special-use": "\\Sent"
},
"Spam":{
"special-use": "\\Junk"
},
"Starred":{
"special-use": "\\Flagged"
},
"Trash":{
"special-use": "\\Trash"
}
"INBOX": {
messages: [{
raw: "Subject: hello 1\r\n\r\nWorld 1!",
internaldate: "14-Sep-2013 21:22:28 -0300"
}, {
raw: "Subject: hello 2\r\n\r\nWorld 2!",
flags: ["\\Seen"]
}, {
raw: "Subject: hello 3\r\n\r\nWorld 3!"
}, {
raw: "From: sender name <[email protected]>\r\n" +
"To: Receiver name <[email protected]>\r\n" +
"Subject: hello 4\r\n" +
"Message-Id: <abcde>\r\n" +
"Date: Fri, 13 Sep 2013 15:01:00 +0300\r\n" +
"\r\n" +
"World 4!"
}, {
raw: "Subject: hello 5\r\n\r\nWorld 5!"
}, {
raw: "Subject: hello 6\r\n\r\nWorld 6!"
}]
},
"": {
"separator": "/",
"folders": {
"[Gmail]": {
"flags": ["\\Noselect"],
"folders": {
"All Mail": {
"special-use": "\\All"
},
"Drafts": {
"special-use": "\\Drafts"
},
"Important": {
"special-use": "\\Important"
},
"Sent Mail": {
"special-use": "\\Sent"
},
"Spam": {
"special-use": "\\Junk"
},
"Starred": {
"special-use": "\\Flagged"
},
"Trash": {
"special-use": "\\Trash"
}
}
}
}
},
}
},
debug: true
});

const PORT = 1143;

server.listen(PORT, function(){
server.listen(PORT, function() {
console.log("Hoodiecrow listening on port %s", PORT)
});
});
15 changes: 8 additions & 7 deletions examples/plugin_simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ hoodiecrow({

// Plugin handler

function myAwesomePlugin(server){
function myAwesomePlugin(server) {

// Add a string to the capability listing
server.registerCapability("XSUM");
Expand All @@ -25,14 +25,14 @@ function myAwesomePlugin(server){
* @param {String} data - Input command as a binary string
* @param {Function} callback - callback function to run
*/
server.setCommandHandler("XSUM", function(connection, parsed, data, callback){
server.setCommandHandler("XSUM", function(connection, parsed, data, callback) {

// Send untagged XSUM response
connection.send({
tag: "*",
command: "XSUM",
attributes:[
[].concat(parsed.attributes || []).reduce(function(prev, cur){
attributes: [
[].concat(parsed.attributes || []).reduce(function(prev, cur) {
return prev + Number(cur.value);
}, 0)
]
Expand All @@ -42,9 +42,10 @@ function myAwesomePlugin(server){
connection.send({
tag: parsed.tag,
command: "OK",
attributes:[
{type: "TEXT", value: "XSUM completed"}
]
attributes: [{
type: "TEXT",
value: "XSUM completed"
}]
}, "XSUM", parsed, data);
callback();
});
Expand Down
Loading

0 comments on commit 272c50b

Please sign in to comment.