Handle nbxmpp error results
This commit is contained in:
parent
5059f72373
commit
1256372d36
|
@ -17,6 +17,7 @@
|
|||
import logging
|
||||
|
||||
import nbxmpp
|
||||
from nbxmpp.util import is_error_result
|
||||
|
||||
from gajim.common import app
|
||||
from gajim.common.nec import NetworkEvent
|
||||
|
@ -62,8 +63,8 @@ class Blocking(BaseModule):
|
|||
log.info('Discovered blocking: %s', from_)
|
||||
|
||||
def _blocking_list_received(self, result):
|
||||
if result.is_error:
|
||||
log.info('Error: %s', result.error)
|
||||
if is_error_result(result):
|
||||
log.info('Error: %s', result)
|
||||
return
|
||||
|
||||
self.blocked = result.blocking_list
|
||||
|
|
|
@ -22,6 +22,7 @@ import logging
|
|||
import copy
|
||||
|
||||
import nbxmpp
|
||||
from nbxmpp.util import is_error_result
|
||||
from nbxmpp.structs import BookmarkData
|
||||
from nbxmpp.const import BookmarkStoreType
|
||||
from gi.repository import GLib
|
||||
|
@ -161,6 +162,10 @@ class Bookmarks(BaseModule):
|
|||
type_, callback=self._bookmarks_received)
|
||||
|
||||
def _bookmarks_received(self, bookmarks):
|
||||
if is_error_result(bookmarks):
|
||||
log.info('Error: %s', bookmarks)
|
||||
bookmarks = []
|
||||
|
||||
self._request_in_progress = False
|
||||
self._bookmarks = bookmarks
|
||||
self.auto_join_bookmarks()
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
import logging
|
||||
|
||||
import nbxmpp
|
||||
from nbxmpp.util import is_error_result
|
||||
|
||||
from gajim.common import app
|
||||
from gajim.common.modules.base import BaseModule
|
||||
|
@ -65,6 +66,10 @@ class UserAvatar(BaseModule):
|
|||
jid, data.id, callback=self._avatar_received)
|
||||
|
||||
def _avatar_received(self, result):
|
||||
if is_error_result(result):
|
||||
log.info('Error: %s', result)
|
||||
return
|
||||
|
||||
log.info('Received Avatar: %s %s', result.jid, result.sha)
|
||||
app.interface.save_avatar(result.data)
|
||||
|
||||
|
|
Loading…
Reference in New Issue