jp (roster): added resync command to do a full roster resynchronisation
This commit is contained in:
parent
f51e924eb6
commit
8c6be44375
1 changed files with 28 additions and 4 deletions
|
|
@ -19,11 +19,11 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import base
|
||||
from sat_frontends.jp.constants import Const as C
|
||||
from sat.core.i18n import _
|
||||
|
||||
from twisted.words.protocols.jabber import jid
|
||||
from collections import OrderedDict
|
||||
from functools import partial
|
||||
from sat.core.i18n import _
|
||||
from sat_frontends.jp.constants import Const as C
|
||||
from twisted.words.protocols.jabber import jid
|
||||
|
||||
__commands__ = ["Roster"]
|
||||
|
||||
|
|
@ -207,8 +207,32 @@ class Get(base.CommandBase):
|
|||
self.host.quit()
|
||||
|
||||
|
||||
class Resync(base.CommandBase):
|
||||
|
||||
def __init__(self, host):
|
||||
super(Resync, self).__init__(
|
||||
host, 'resync', help=_(u'do a full resynchronisation of roster with server'))
|
||||
self.need_loop = True
|
||||
|
||||
def add_parser_options(self):
|
||||
pass
|
||||
|
||||
def rosterResyncCb(self):
|
||||
self.disp(_(u"Roster resynchronized"))
|
||||
self.host.quit(C.EXIT_OK)
|
||||
|
||||
def start(self):
|
||||
self.host.bridge.rosterResync(profile_key=self.host.profile,
|
||||
callback=self.rosterResyncCb,
|
||||
errback=partial(
|
||||
self.errback,
|
||||
msg=_(u"can't resynchronise roster: {}"),
|
||||
exit_code=C.EXIT_BRIDGE_ERRBACK,
|
||||
))
|
||||
|
||||
|
||||
class Roster(base.CommandBase):
|
||||
subcommands = (Get, Stats, Purge)
|
||||
subcommands = (Get, Stats, Purge, Resync)
|
||||
|
||||
def __init__(self, host):
|
||||
super(Roster, self).__init__(host, 'roster', use_profile=True, help=_("Manage an entity's roster"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue