Commit c208f411 authored by Philipp Hörist's avatar Philipp Hörist

Delimiter: Adapt to nbxmpp changes

parent ce68aa99
Pipeline #6680 passed with stages
in 4 minutes and 28 seconds
......@@ -14,53 +14,41 @@
# XEP-0083: Nested Roster Groups
import nbxmpp
from nbxmpp.namespaces import Namespace
from nbxmpp.errors import is_error
from nbxmpp.modules.util import raise_if_error
from gajim.common.modules.base import BaseModule
from gajim.common.modules.util import as_task
class Delimiter(BaseModule):
_nbxmpp_extends = 'Delimiter'
_nbxmpp_methods = [
def __init__(self, con):
BaseModule.__init__(self, con)
self.available = False
self.delimiter = '::'
def get_roster_delimiter(self):'Request')
node = nbxmpp.Node('storage', attrs={'xmlns': 'roster:delimiter'})
iq = nbxmpp.Iq('get', Namespace.PRIVATE, payload=node)
iq, self._delimiter_received)
_task = yield
def _delimiter_received(self, _nbxmpp_client, stanza):
if not nbxmpp.isResultNode(stanza):'Request error: %s', stanza.getError())
delimiter = stanza.getQuery().getTagData('roster')
self.available = True'Delimiter received: %s', delimiter)
if delimiter:
self.delimiter = delimiter
delimiter = yield self.request_delimiter()
if is_error(delimiter) or delimiter is None:
result = yield self.set_delimiter(self.delimiter)
delimiter = self.delimiter
self.delimiter = delimiter
self.available = True
def set_roster_delimiter(self):'Set delimiter')
iq = nbxmpp.Iq('set', Namespace.PRIVATE)
roster = iq.getQuery().addChild('roster', namespace='roster:delimiter')
iq, self._set_delimiter_response)
def _set_delimiter_response(self, _nbxmpp_client, stanza):
if not nbxmpp.isResultNode(stanza):'Store error: %s', stanza.getError())
def get_instance(*args, **kwargs):
return Delimiter(*args, **kwargs), 'Delimiter'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment