plugin XEP-0048, XEP-0402; CLI (bookmarks): implement XEP-0402 (PEP Native Bookmarks):
- Former bookmarks implementation is now labeled as "legacy". - XEP-0402 is now used for bookmarks when relevant namespaces are found, and it fallbacks to legacy XEP-0048/XEP-0049 bookmarks otherwise. - CLI legacy bookmark commands have been moved to `bookmarks legacy` - CLI bookmarks commands now use the new XEP-0402 (with fallback to legacy one automatically used if necessary).
This commit is contained in:
parent
0c27fef2ac
commit
06a1eef720
1 changed files with 858 additions and 165 deletions
|
|
@ -16,27 +16,26 @@
|
|||
# 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/>.
|
||||
|
||||
import argparse
|
||||
import asyncio
|
||||
from libervia.backend.core.i18n import _
|
||||
|
||||
### logging ###
|
||||
from collections import OrderedDict
|
||||
from glob import iglob
|
||||
from importlib import import_module
|
||||
import inspect
|
||||
import logging as log
|
||||
|
||||
log.basicConfig(level=log.WARNING, format="[%(name)s] %(message)s")
|
||||
###
|
||||
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
import argparse
|
||||
import inspect
|
||||
import tty
|
||||
import termios
|
||||
from pathlib import Path
|
||||
from glob import iglob
|
||||
import sys
|
||||
import termios
|
||||
import tty
|
||||
from typing import Optional, Set, Union
|
||||
from importlib import import_module
|
||||
from libervia.frontends.tools.jid import JID
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from rich import console
|
||||
|
||||
from libervia.backend.core import exceptions
|
||||
from libervia.backend.core.i18n import _
|
||||
from libervia.backend.tools import config
|
||||
from libervia.backend.tools.common import dynamic_import
|
||||
from libervia.backend.tools.common import uri
|
||||
|
|
@ -44,15 +43,17 @@ from libervia.backend.tools.common import date_utils
|
|||
from libervia.backend.tools.common import utils
|
||||
from libervia.backend.tools.common import data_format
|
||||
from libervia.backend.tools.common.ansi import ANSI as A
|
||||
from libervia.backend.core import exceptions
|
||||
import libervia.cli
|
||||
from libervia.cli.loops import QuitException, get_libervia_cli_loop
|
||||
from libervia.cli.constants import Const as C
|
||||
from libervia.cli.loops import QuitException, get_libervia_cli_loop
|
||||
from libervia.frontends.bridge.bridge_frontend import BridgeException
|
||||
from libervia.frontends.tools import aio, misc
|
||||
import xml.etree.ElementTree as ET # FIXME: used temporarily to manage XMLUI
|
||||
from collections import OrderedDict
|
||||
from rich import console
|
||||
from libervia.frontends.tools.jid import JID
|
||||
|
||||
log.basicConfig(level=log.WARNING, format="[%(name)s] %(message)s")
|
||||
###
|
||||
|
||||
|
||||
|
||||
## bridge handling
|
||||
# we get bridge name from conf and initialise the right class accordingly
|
||||
|
|
@ -90,6 +91,21 @@ PROGRESS_DELAY = 0.1 # the progression will be checked every PROGRESS_DELAY s
|
|||
def date_decoder(arg):
|
||||
return date_utils.date_parse_ext(arg, default_tz=date_utils.TZ_LOCAL)
|
||||
|
||||
def optional_bool_decoder(arg: str) -> bool:
|
||||
"""Decode an optional string to a boolean value.
|
||||
|
||||
@param value: The input string to decode.
|
||||
@return: The decoded boolean value.
|
||||
@raise ValueError: If the input string is not a valid boolean representation.
|
||||
"""
|
||||
lower_arg = arg.lower()
|
||||
if lower_arg in ['true', '1', 't', 'y', 'yes']:
|
||||
return True
|
||||
elif lower_arg in ['false', '0', 'f', 'n', 'no']:
|
||||
return False
|
||||
else:
|
||||
raise ValueError(f"Invalid boolean value: {arg}")
|
||||
|
||||
|
||||
class LiberviaCli:
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue