Skip to content
Browse files

updated readme, fixed fetching of addressbook cards

  • Loading branch information...
1 parent ee18930 commit 5eef12e9cfdfd364a65e7b08de9a59a1540588f4 @mikedeboer committed Feb 15, 2013
Showing with 12 additions and 13 deletions.
  1. +4 −4 examples/addressbookserver.js
  2. +4 −4 lib/CardDAV/backends/redis.js
  3. +1 −1 lib/CardDAV/card.js
  4. +0 −1 lib/CardDAV/plugin.js
  5. +3 −3 package.json
View
8 examples/addressbookserver.js
@@ -49,21 +49,21 @@ redis.multi([
["HMSET", "principals/principals/admin/calendar-proxy-write", "email", "", "displayname", ""],
// create the first addressbook
["SET", "addressbooks/ID", "1"],
- ["HMSET", "addressbooks/1", "principaluri", "principals/admin", "displayname", "default calendar", "uri", "default", "description", "", "ctag", "1"],
+ ["HMSET", "addressbooks/1", "principaluri", "principals/admin", "displayname", "default addressbook", "uri", "default", "description", "", "ctag", "1"],
["HMSET", "addressbooks/principalUri", "principals/admin", "[1]"]
]).exec(function(err) {
if (err)
throw(err);
// Backends
- var authBackend = jsDAV_Auth_Backend_Redis.new(redis);
+ var authBackend = jsDAV_Auth_Backend_Redis.new(redis);
var principalBackend = jsDAVACL_PrincipalBackend_Redis.new(redis);
- var carddavBackend = jsCardDAV_Backend_Redis.new(redis);
+ var carddavBackend = jsCardDAV_Backend_Redis.new(redis);
// Setting up the directory tree //
var nodes = [
jsDAVACL_PrincipalCollection.new(principalBackend),
- jsCardDAV_AddressBookRoot.new(principalBackend, carddavBackend),
+ jsCardDAV_AddressBookRoot.new(principalBackend, carddavBackend)
];
jsDAV.createServer({
View
8 lib/CardDAV/backends/redis.js
@@ -309,7 +309,7 @@ var jsCardDAV_Backend_Redis = module.exports = jsCardDAV_iBackend.extend({
cards.push({
uri: cardUris[idx],
carddata: data[0],
- lastmodified: data[1]
+ lastmodified: parseInt(data[1], 10)
});
});
callback(null, cards);
@@ -339,7 +339,7 @@ var jsCardDAV_Backend_Redis = module.exports = jsCardDAV_iBackend.extend({
callback(null, {
uri: cardUri,
carddata: res[0],
- lastmodified: res[1]
+ lastmodified: parseInt(res[1], 10)
});
});
},
@@ -374,7 +374,7 @@ var jsCardDAV_Backend_Redis = module.exports = jsCardDAV_iBackend.extend({
var now = Date.now();
var commands = [
["HMSET", this.cardsTableName + "/" + addressBookId + "/" + cardUri, "carddata", cardData, "lastmodified", now],
- ["ZADD", this.addressBooksTableName + "/" + this.cardsTableName, now, cardUri]
+ ["ZADD", this.addressBooksTableName + "/" + addressBookId + "/" + this.cardsTableName, now, cardUri]
];
this.redis.hget(this.addressBooksTableName + "/" + addressBookId, "ctag", function(err, ctag) {
if (err)
@@ -446,7 +446,7 @@ var jsCardDAV_Backend_Redis = module.exports = jsCardDAV_iBackend.extend({
var self = this;
var commands = [
["DEL", this.cardsTableName + "/" + addressBookId + "/" + cardUri],
- ["ZREM", this.addressBooksTableName + "/" + this.cardsTableName, cardUri]
+ ["ZREM", this.addressBooksTableName + "/" + addressBookId + "/" + this.cardsTableName, cardUri]
];
this.redis.hget(this.addressBooksTableName + "/" + addressBookId, "ctag", function(err, ctag) {
if (err)
View
2 lib/CardDAV/card.js
@@ -155,7 +155,7 @@ var jsCardDAV_Card = module.exports = jsDAV_File.extend(jsCardDAV_iCard, jsDAVAC
this.get(function(err, cardData) {
if (err)
return callback(err);
- callback(null, cardData.carddata.length);
+ callback(null, cardData.length);
});
},
View
1 lib/CardDAV/plugin.js
@@ -175,7 +175,6 @@ var jsCardDAV_Plugin = module.exports = jsDAV_Plugin.extend({
// property, but in large chunks of the spec it does act as such.
// Therefore we simply expose it as a property.
var addressDataProp = "{" + this.NS_CARDDAV + "}address-data";
- var addressIdx = requestedProperties.indexOf(addressDataProp)
if (requestedProperties[addressDataProp]) {
delete requestedProperties[addressDataProp];
node.get(function(err, val) {
View
6 package.json
@@ -11,7 +11,7 @@
"main": "lib/jsdav",
"repository" : {
"type" : "git",
- "url" : "http://github.com/ajaxorg/jsDAV.git"
+ "url" : "http://github.com/mikedeboer/jsDAV.git"
},
"dependencies": {
"asyncjs": "~0.0.8",
@@ -28,6 +28,6 @@
},
"licenses": [{
"type": "The MIT License",
- "url": "http://www.opensource.org/licenses/mit-license.php"}
- ]
+ "url": "http://www.opensource.org/licenses/mit-license.php"
+ }]
}

0 comments on commit 5eef12e

Please sign in to comment.
Something went wrong with that request. Please try again.