fix XML -> PubSub transition for bookmarks when bookmarks node doesn't exist

This commit is contained in:
Yann Leboulanger 2009-08-04 00:36:28 +02:00
parent f501c2c4fe
commit 1f32083334
2 changed files with 13 additions and 0 deletions

View File

@ -2765,6 +2765,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
con.RegisterHandler('iq', self._PrivacySetCB, 'set',
common.xmpp.NS_PRIVACY)
con.RegisterHandler('iq', self._PubSubCB, 'result')
con.RegisterHandler('iq', self._PubSubErrorCB, 'error')
con.RegisterHandler('iq', self._ErrorCB, 'error')
con.RegisterHandler('iq', self._IqCB)
con.RegisterHandler('iq', self._StanzaArrivedCB)

View File

@ -166,6 +166,18 @@ class ConnectionPubSub:
if ns == 'storage:bookmarks':
self._parse_bookmarks(storage, 'pubsub')
def _PubSubErrorCB(self, conn, stanza):
gajim.log.debug('_PubsubErrorCB')
pubsub = stanza.getTag('pubsub')
if not pubsub:
return
items = pubsub.getTag('items')
if not items:
return
if items.getAttr('node') == 'storage:bookmarks':
# Receiving bookmarks from pubsub failed, so take them from xml
self.get_bookmarks(storage_type='xml')
def request_pb_configuration(self, jid, node):
if not self.connection or self.connected < 2:
return