Commit graph libervia-backend/sat_frontends/jp
Author SHA1 Message Date
Goffi
095ec0c71a jp (account): better exit code handling 2020-12-04 12:32:56 +01:00
Goffi
92e424e685 jp (roster): delete implementation 2020-11-12 14:53:16 +01:00
Goffi
df6428c14c jp (pubsub/node/info, pubsub/get): better exit code:
the correct exit code is now returned in case of NOT_FOUND or bridge exception. If the
exception is not a bridge exception, an internal error exit code is used.
2020-11-12 14:53:16 +01:00
Goffi
d818f1737b jp (base, pubsub/set): new --quiet argument:
`--quiet` can be used to only return essential data from command. This is notably useful
to remove message and trailing line feed when returning a data which must be parsed by an
other program.
2020-11-12 14:53:16 +01:00
Goffi
1d9d13dc04 jp: follow best practices and use a dash (-) instead of underscore (_) for long options. 2020-11-12 14:53:16 +01:00
Goffi
cc61784c2e jp (file/receive): display or answer to C.META_TYPE_NOT_IN_ROSTER_LEAK dialog:
when a file is proposed by an entity not in roster, the dialog asking for confirmation
is displayed. If the bare jid of the sender is explicitely waited (i.e. it's in
arguments), then the dialog is automatically confirmed.
2020-11-12 14:53:16 +01:00
Goffi
f1ec7b4d43 jp: new confirm method:
it completes `confirmOrQuit` method to ask confirmation without quitting.
2020-11-12 14:53:16 +01:00
Goffi
ed39d5340d jp (file/send): don't add main resource to bare jid anymore:
bare jid sending is now managed by backend (at least for Jingle), so resource must not be
added automatically anymore.
2020-11-12 14:53:16 +01:00
Goffi
f4c7f5e55e jp: replace no_lf argument by end in disp (same as in print) 2020-11-12 14:53:16 +01:00
Goffi
883a07c591 core (constants): moved shell exit code constants to core constants:
Well defined shell exit code are generally useful, not only for jp, thus constants have been
moved to core.
2020-11-12 14:53:15 +01:00
Goffi
4c2c9b4f04 jp: don't guess background when stdout is not a tty 2020-10-15 14:44:42 +02:00
Goffi
7b746a50a8 jp (application/list): don't use extend in argument as in it Python 3.8+ only 2020-10-01 10:12:01 +02:00
Goffi
fd34697ac8 jp (application): new application (or app) commands:
those commands allow to:

- list available SàT applications
- start an application
- stop an application
- display/get exposed values
2020-09-28 21:10:33 +02:00
Goffi
03cffe789c core: minor typos, docstring/comments update 2020-09-20 14:05:40 +02:00
Goffi
e60b64d876 plugin XEP-0313: fixed MAMGet signature 2020-09-17 10:46:13 +02:00
Goffi
4909433e83 jp (blog/edit): fixed edition when syntax is specified 2020-08-15 20:29:44 +02:00
Goffi
db286b98e4 jp (invitation): delete implementation 2020-08-13 23:46:18 +02:00
Goffi
81a11ba6d6 jp (file/share): added commands to manage affiliations and configuration + documentation 2020-08-01 16:25:50 +02:00
Goffi
f8b346e115 plugin XEP-0060: serialise psItemsGet result with data_format 2020-07-17 12:57:23 +02:00
Goffi
95096df52f plugins tickets, merge-requests: ticketsGet and mergeRequestsGet serialisation:
those methods now return data serialised with `data_format.serialise`
2020-07-16 09:07:26 +02:00
Goffi
e03eb5bfcc plugins XEP-0059, XEP-0060, XEP-0277, XEP-0313: better serialisation:
`data_format.serialise` is now used for `mbGet`, and RSM/MAM values are not transtyped to
strings anymore. A serialised dict is now used, items are put in the `items` key.

Comments handling has been refactored to use a list for the potentially multiple comments
nodes.

`rsm` data are now in a `rsm` key of the dict, and `mam` data are merged with other
metadata.
2020-07-16 09:07:20 +02:00
Goffi
85a3e6edfb jp (event): new list command to get evens available in a service 2020-05-18 23:48:40 +02:00
Goffi
e1abce602f jp (pubsub): fixed arguments returned when item has no payload 2020-05-18 23:43:06 +02:00
Goffi
7a2ab7c468 jp (roster): new roster/set command 2020-04-14 21:01:04 +02:00
Goffi
88072e0453 core, frontends: avatar refactoring:
/!\ huge commit

Avatar logic has been reworked around the IDENTITY plugin: plugins able to handle avatar
or other identity related metadata (like nicknames) register to IDENTITY plugin in the
same way as for other features like download/upload. Once registered, IDENTITY plugin will
call them when suitable in order of priority, and handle caching.

Methods to manage those metadata from frontend now use serialised data.

For now `avatar` and `nicknames` are handled:

- `avatar` is now a dict with `path` + metadata like `media_type`, instead of just a string
  path
- `nicknames` is now a list of nicknames in order of priority. This list is never empty,
  and `nicknames[0]` should be the preferred nickname to use by frontends in most cases.
  In addition to contact specified nicknames, user set nickname (the one set in roster) is
  used in priority when available.

Among the side changes done with this commit, there are:

- a new `contactGet` bridge method to get roster metadata for a single contact
- SatPresenceProtocol.send returns a Deferred to check when it has actually been sent
- memory's methods to handle entities data now use `client` as first argument
- metadata filter can be specified with `getIdentity`
- `getAvatar` and `setAvatar` are now part of the IDENTITY plugin instead of XEP-0054 (and
  there signature has changed)
- `isRoom` and `getBareOrFull` are now part of XEP-0045 plugin
- jp avatar/get command uses `xdg-open` first when available for `--show` flag
- `--no-cache` has been added to jp avatar/get and identity/get
- jp identity/set has been simplified, explicit options (`--nickname` only for now) are
  used instead of `--field`. `--field` may come back in the future if necessary for extra
  data.
- QuickContactList `SetContact` now handle None as a value, and doesn't use it to delete the
  metadata anymore
- improved cache handling for `metadata` and `nicknames` in quick frontend
- new `default` argument in QuickContactList `getCache`
2020-04-14 21:00:33 +02:00
Goffi
09cb00b5b1 jp (blog/edit): --no-publish is a boolean option 2020-03-31 08:45:49 +02:00
Goffi
e0a5e96b16 jp (xmlui): added missing disp method in XMLUIPanel 2020-03-06 18:51:04 +01:00
Goffi
dced27f328 jp(info): devices command first draft:
this command gather data on known devices of an entity.
2020-03-06 18:19:03 +01:00
Goffi
a194874638 bridge: messageSend's extra is now serialised 2020-02-21 12:17:38 +01:00
Goffi
3d8ef1d625 jp (blog/edit): added --no-publish argument. 2020-02-18 18:17:18 +01:00
Goffi
e1a44cf4e4 fixed shebangs 2020-01-29 10:07:00 +01:00
Goffi
a39349fe64 dates update 2020-01-29 09:50:54 +01:00
Goffi
87659cf0f0 core (memory/params): added extra argument to filter out params notably in getParamsUI:
In some case, it may be desirable for a frontend to not expose some parameters to user
(e.g. it is the case on Android with the `autoconnect_backend` parameter). An new `extra`
parameter has been added to a couple of parameters method for that: it can contain the
`ignore` key with a list of [category, name] of parameters to skip.
2020-01-25 21:08:40 +01:00
Goffi
610a8ff10b jp (profile): added --autoconnect argument in modify and create + use output in info 2020-01-25 21:08:39 +01:00
Goffi
da3b7b5fea jp (common): various Table fixes:
- renamed fromDict to more accurate fromListDict
- fixed handling of None filter in fromListDict
- fixes show_header when no header exist
- escape headers when using namedtuple, so it won't fail
2020-01-25 21:08:37 +01:00
Goffi
7dd0df7f41 core, bridge: encryptionPluginsGet now returns a serialised list + added "directed" in metadata 2019-12-30 20:44:04 +01:00
Goffi
b7a74d5034 plugin XEP-0060, jp (pubsub/set): publish-options implementation:
- publishing options (XEP-0060 §7.1.5) implementation.
- jp pubsub/set can specify publish-options using `-f` and `-F`
- doc has been updated to explain that
- psItemSend and psItemsSend now use serialisation for "extra"
- publish-options can be specified in extra['publish-options'] with those methods
2019-12-28 20:02:18 +01:00
Goffi
1eee84c8f3 jp (blog): added --language to common publish argument 2019-12-20 14:23:42 +01:00
Goffi
2d49de9209 jp (file): new get command + encryption with upload:
- new file/get command let download a file from URL. It handles `aesgcm:` scheme by
thanks to backend decryption on the fly.
- new `--encrypt` option for upload. When used, the file will be encrypted using AES-GCM
  algorithm, and the `aesgcm:` URL will be returned
- for both commands, the XMLUI note is displayed in case of error
2019-12-20 12:28:04 +01:00
Goffi
5c1dd0da49 jp (xmlui_manager): use level for notes:
display notes in specific colors according to level, and use stderr for warnings and
errors.
2019-12-20 12:28:04 +01:00
Goffi
edbee4d719 plugin upload, XEP-0363: code modernisation + preparation for extension:
- use of async/await syntax
- fileUpload's options are now serialised, allowing non string values
- (XEP-0363) Slot is now a dataclass, so it can be modified by other plugins
- (XEP-0363) Moved SSL related code to the new tools.web module
- (XEP-0363) added `XEP-0363_upload_size` and `XEP-0363_upload` trigger points
- a Deferred is not used anymore for `progress_id`, the value is directly returned
2019-12-20 12:28:04 +01:00
Goffi
7f66a2f154 jp (file/upload): fixed exception when no jid is specified 2019-11-08 11:47:42 +01:00
Goffi
4e9b0f0d54 jp: default to "dark" if background is not set and can't be detected 2019-10-03 22:17:19 +02:00
Goffi
36ccde03b9 jp: password is now prompted if needed:
if password is not specified on command line, it is now prompted if it is needed to start
a profile session or connect it. The password is prompted with echo disabled, so somebody
seing the computer screen can't see the password.

fix 207
2019-10-01 22:49:11 +02:00
Goffi
5a2d7e2943 jp (debug): new "theme" command to print colour theme according to background value:
fix 321
2019-10-01 22:49:11 +02:00
Goffi
1efb60a429 jp: dark and light theme:
- `background` setting can now be used in sat.conf to indicate if the terminal use a
  `dark` or a `light` colour
- if `background` is not set or set to `auto`, the background colour is autodetected
- Jp.get_config (or CommandBase.get_config) method can now be used to retrieve a setting
2019-10-01 22:49:10 +02:00
Goffi
c61f6237a4 jp: handle dbus bridge with asyncio:
D-Bus bridge is now working again, using the new AsyncIO version. To make it work, the
GLib loop is run in a separated thread.

Loops have been moved to the `loops` module.
2019-10-01 22:49:10 +02:00
Goffi
76aadbb3fb jp: jp asyncio port:
/!\ this commit is huge. Jp is temporarily not working with `dbus` bridge /!\

This patch implements the port of jp to asyncio, so it is now correctly using the bridge
asynchronously, and it can be used with bridges like `pb`. This also simplify the code,
notably for things which were previously implemented with many callbacks (like pagination
with RSM).

During the process, some behaviours have been modified/fixed, in jp and backends, check
diff for details.
2019-09-25 08:56:41 +02:00
Goffi
b8e9212b8d jp (common): fixed draft path use in BaseEdit 2019-08-26 09:14:58 +02:00
Goffi
fbfe96c505 Python 3 port:
/!\ this is a huge commit
/!\ starting from this commit, SàT is needs Python 3.6+
/!\ SàT maybe be instable or some feature may not work anymore, this will improve with time

This patch port backend, bridge and frontends to Python 3.

Roughly this has been done this way:

- 2to3 tools has been applied (with python 3.7)
- all references to python2 have been replaced with python3 (notably shebangs)
- fixed files not handled by 2to3 (notably the shell script)
- several manual fixes
- fixed issues reported by Python 3 that where not handled in Python 2
- replaced "async" with "async_" when needed (it's a reserved word from Python 3.7)
- replaced zope's "implements" with @implementer decorator
- temporary hack to handle data pickled in database, as str or bytes may be returned,
  to be checked later
- fixed hash comparison for password
- removed some code which is not needed anymore with Python 3
- deactivated some code which needs to be checked (notably certificate validation)
- tested with jp, fixed reported issues until some basic commands worked
- ported Primitivus (after porting dependencies like urwid satext)
- more manual fixes
2019-08-13 19:08:41 +02:00