> I still need to investigate the origin of `jabber-bookmarks' hash
> table corruption.  It may be related to talk.google.com jabber server
> (@gmail.com) not supporting bookmarks feature...
>
>     Storing bookmarks failed: Feature not implemented

Google Talk does not support bookmarks (XEP-0048), indeed, but this
has nothing to do with the problem.

Non-list hash values originate from `jabber-get-bookmarks-1' function:

| (defun jabber-get-bookmarks-1 (jc result cont)
|   (let ((my-jid (jabber-connection-bare-jid jc))
|       (value
|        (if (eq (jabber-xml-node-name result) 'storage)
|            (or (jabber-xml-node-children result) t)
|          t)))
|     (puthash my-jid value jabber-bookmarks)
|     (funcall cont jc (when (listp value) value))))

There are two patches to choose from.

One prevents `jabber-get-bookmarks-1' from inserting `t' values into
hash table [jabber-bookmarks_omit-t.patch].

--- jabber-bookmarks.el.orig	2008-08-26 16:43:09.000000000 +0300
+++ jabber-bookmarks.el	2008-12-13 00:48:10.143646075 +0200
@@ -39,7 +39,8 @@
 immediately, and return nil if it is not in the cache."
   (if (null cont)
       (jabber-get-conference-data-internal
-       (jabber-get-bookmarks-from-cache jc)
+       (let ((rooms (jabber-get-bookmarks-from-cache jc)))
+	 (when (listp rooms) rooms))
        conference-jid
        key)
     (jabber-get-bookmarks 
@@ -94,7 +95,7 @@
 	 (if (eq (jabber-xml-node-name result) 'storage)
 	     (or (jabber-xml-node-children result) t)
 	   t)))
-    (puthash my-jid value jabber-bookmarks)
+    (when (listp value) (puthash my-jid value jabber-bookmarks))
     (funcall cont jc (when (listp value) value))))
 
 ;;;###autoload
Another replaces `t' with `nil' values which _are_ inserted
[jabber-bookmarks_put-nil.patch].

--- jabber-bookmarks.el.orig	2008-08-26 16:43:09.000000000 +0300
+++ jabber-bookmarks.el	2008-12-13 01:07:59.390818298 +0200
@@ -39,7 +39,8 @@
 immediately, and return nil if it is not in the cache."
   (if (null cont)
       (jabber-get-conference-data-internal
-       (jabber-get-bookmarks-from-cache jc)
+       (let ((rooms (jabber-get-bookmarks-from-cache jc)))
+	 (when (listp rooms) rooms))
        conference-jid
        key)
     (jabber-get-bookmarks 
@@ -90,10 +91,8 @@
 
 (defun jabber-get-bookmarks-1 (jc result cont)
   (let ((my-jid (jabber-connection-bare-jid jc))
-	(value 
-	 (if (eq (jabber-xml-node-name result) 'storage)
-	     (or (jabber-xml-node-children result) t)
-	   t)))
+	(value (when (eq (jabber-xml-node-name result) 'storage)
+		 (jabber-xml-node-children result))))
     (puthash my-jid value jabber-bookmarks)
     (funcall cont jc (when (listp value) value))))
 
Both patches share hunk #1: an extra check assuring the first argument
of `jabber-get-conference-data-internal' to be listp.

--
vvv

Reply via email to