sync bookmark descriptions

This commit is contained in:
Dan Mills 2008-05-12 10:11:07 -07:00
parent cb3252bd8d
commit 036c817866

View File

@ -361,6 +361,11 @@ BookmarksStore.prototype = {
this._ts.untagURI(URI, null);
this._ts.tagURI(URI, command.data.tags);
this._bms.setKeywordForBookmark(newId, command.data.keyword);
if (command.data.description) {
this._ans.setItemAnnotation(newId, "bookmarkProperties/description",
command.data.description, 0,
this._ans.EXPIRE_NEVER);
}
if (command.data.type == "microsummary") {
this._log.debug(" \-> is a microsummary");
@ -497,6 +502,13 @@ BookmarksStore.prototype = {
case "keyword":
this._bms.setKeywordForBookmark(itemId, command.data.keyword);
break;
case "description":
if (command.data.description) {
this._ans.setItemAnnotation(itemId, "bookmarkProperties/description",
command.data.description, 0,
this._ans.EXPIRE_NEVER);
}
break;
case "generatorURI": {
let micsumURI = Utils.makeURI(this._bms.getBookmarkURI(itemId));
let genURI = Utils.makeURI(command.data.generatorURI);
@ -573,6 +585,14 @@ BookmarksStore.prototype = {
item.type = "bookmark";
item.title = node.title;
}
try {
item.description =
this._ans.getItemAnnotation(node.itemId, "bookmarkProperties/description");
} catch (e) {
item.description = undefined;
}
item.URI = node.uri;
item.tags = this._ts.getTagsForURI(Utils.makeURI(node.uri), {});
item.keyword = this._bms.getKeywordForBookmark(node.itemId);
@ -797,10 +817,10 @@ CookieStore.prototype = {
in order to sync with the server.
command.data appears to be equivalent to what wrap() puts in
the JSON dictionary. */
this._log.info("CookieStore got removeCommand: " + command );
/* I think it goes like this, according to
/* I think it goes like this, according to
http://developer.mozilla.org/en/docs/nsICookieManager
the last argument is "always block cookies from this domain?"
and the answer is "no". */
@ -821,13 +841,13 @@ CookieStore.prototype = {
while (iter.hasMoreElements()){
let cookie = iter.getNext();
if (cookie instanceof Ci.nsICookie){
// see if host:path:name of cookie matches GUID given in command
// see if host:path:name of cookie matches GUID given in command
let key = cookie.host + ":" + cookie.path + ":" + cookie.name;
if (key == command.GUID) {
matchingCookie = cookie;
break;
}
}
}
}
// Update values in the cookie:
for (var key in command.data) {
@ -848,7 +868,7 @@ CookieStore.prototype = {
matchingCookie.isHttpOnly,
matchingCookie.isSession,
matchingCookie.expiry );
// Also, there's an exception raised because
// this._data[comand.GUID] is undefined
},
@ -878,11 +898,11 @@ CookieStore.prototype = {
isSession: cookie.isSession,
expiry: cookie.expiry,
isHttpOnly: cookie.isHttpOnly }
/* See http://developer.mozilla.org/en/docs/nsICookie
Note: not syncing "expires", "status", or "policy"
since they're deprecated. */
}
}
return items;