jp: all commands now use the new start method and set need_loop in __init__ when needed
This commit is contained in:
parent
89f6fe8605
commit
169bc43793
1 changed files with 46 additions and 84 deletions
|
|
@ -17,8 +17,6 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from logging import debug, info, error, warning
|
||||
|
||||
import base
|
||||
from sat.core.i18n import _
|
||||
|
||||
|
|
@ -43,8 +41,7 @@ class BookmarksList(BookmarksCommon):
|
|||
def __init__(self, host):
|
||||
super(BookmarksList, self).__init__(host, 'list', help=_('list bookmarks'))
|
||||
|
||||
def connected(self):
|
||||
super(BookmarksList, self).connected()
|
||||
def start(self):
|
||||
data = self.host.bridge.bookmarksList(self.args.type, self.args.location, self.host.profile)
|
||||
mess = []
|
||||
for location in STORAGE_LOCATIONS:
|
||||
|
|
@ -68,17 +65,16 @@ class BookmarksList(BookmarksCommon):
|
|||
|
||||
|
||||
class BookmarksRemove(BookmarksCommon):
|
||||
need_loop = True
|
||||
|
||||
def __init__(self, host):
|
||||
super(BookmarksRemove, self).__init__(host, 'remove', help=_('remove a bookmark'))
|
||||
self.need_loop = True
|
||||
|
||||
def add_parser_options(self):
|
||||
super(BookmarksRemove, self).add_parser_options()
|
||||
self.parser.add_argument('bookmark', type=base.unicode_decoder, help=_('jid (for muc bookmark) or url of to remove'))
|
||||
|
||||
def connected(self):
|
||||
super(BookmarksRemove, self).connected()
|
||||
def start(self):
|
||||
self.host.bridge.bookmarksRemove(self.args.type, self.args.bookmark, self.args.location, self.host.profile, callback = lambda: self.host.quit(), errback=self._errback)
|
||||
|
||||
|
||||
|
|
@ -86,6 +82,7 @@ class BookmarksAdd(BookmarksCommon):
|
|||
|
||||
def __init__(self, host):
|
||||
super(BookmarksAdd, self).__init__(host, 'add', help=_('add a bookmark'))
|
||||
self.need_loop = True
|
||||
|
||||
def add_parser_options(self):
|
||||
super(BookmarksAdd, self).add_parser_options(location_default='auto')
|
||||
|
|
@ -95,9 +92,7 @@ class BookmarksAdd(BookmarksCommon):
|
|||
muc_group.add_argument('-N', '--nick', type=base.unicode_decoder, help=_('nickname'))
|
||||
muc_group.add_argument('-a', '--autojoin', action='store_true', help=_('join room on profile connection'))
|
||||
|
||||
def connected(self):
|
||||
self.need_loop = True
|
||||
super(BookmarksAdd, self).connected()
|
||||
def start(self):
|
||||
if self.args.type == 'url' and (self.args.autojoin or self.args.nick is not None):
|
||||
# XXX: Argparse doesn't seem to manage this case, any better way ?
|
||||
print _(u"You can't use --autojoin or --nick with --type url")
|
||||
|
|
|
|||
Loading…
Reference in a new issue