Commit graph libervia-backend/sat_frontends/quick_frontend/quick_chat.py
Author SHA1 Message Date
Goffi
6a6f15707a massive refactoring to switch from camelCase to snake_case:
historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a
pre-PEP8 code, to use the same coding style as in Twisted.

However, snake_case is more readable and it's better to follow PEP8 best practices, so it
has been decided to move on full snake_case. Because Libervia has a huge codebase, this
ended with a ugly mix of camelCase and snake_case.

To fix that, this patch does a big refactoring by renaming every function and method
(including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case.

This is a massive change, and may result in some bugs.
2023-04-08 13:54:42 +02:00
Goffi
c3f97ec712 component AP gateway: handle attachments 2023-03-23 15:42:21 +01:00
Goffi
dc86957043 date update 2021-03-19 15:45:14 +01: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
741bd88a19 quick frontend (chat): added encrypted property 2020-03-23 16:53:29 +01:00
Goffi
8812915d4e quick frontends (chat): handle attachments in Message 2020-02-18 18:17:18 +01:00
Goffi
6a7d247754 core: use serialised dict for extra in messageNew and historyGet 2020-02-18 18:13:17 +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
efe52d755d plugin XEP-0045: added room statuses to metadata:
room statuses are now sent with other metadata on bridge signals, and saved in Room
instance. They give useful data on the room, for instance they can be used to know if a
full jid is used in this room.
2019-12-30 20:44:02 +01:00
Goffi
6bf470ea9f quick frontend(chat): store filters used with initial historyGet 2019-11-18 22:34:13 +01:00
Goffi
adf7621495 quick frontend (chat): removed hack not needed anymore now that Pyjamas is not used anymore 2019-11-08 11:56:21 +01: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
Goffi
31a9e2bd09 quick frontend (chat), primitivus(chat): properly clear occupants on resync:
occupants widgets were not cleared in Primitivus on resync while occupants dictionary was, resulting in nicknames sometimes apearing doubled in Primitivus MUC rooms.

A new occupantsClear method has been added in QuickChat, so it can be overriden by frontends to clear widgets or other representations of occupants.

fix 304
2019-07-06 12:22:25 +02:00
Goffi
e14e69c883 quick frontends (app, chat): disabled the 2 most verbose logs, as they are barely useful and make reading logs difficult. 2019-06-30 15:41:59 +02:00
Goffi
f0c567d949 quick_frontend (app): fixed filters serialisation before calling bridge.historyGet 2019-04-07 20:58:15 +02:00
Goffi
a28d1d136a quick frontend(chat): prepared factorisation of merging of user moved info messages:
- new MessageWidget class, to have a common ancestor for widgets from different frontends
- new message_widgets_rev property to get reverse iterator on message widgets
- new isUserMoved method to check if a Message is a user moved info
- new handleUserMoved method to merge info message when suitable. This is code from Primitivus made generic.
2019-03-28 08:39:19 +01:00
Goffi
833cfb25bb quick frontend(chat): fixed updateHistory bad call to historyPrint 2019-03-20 19:33:38 +01:00
Goffi
4c8f108192 quick_frontend (widget, chat): implementation of new sync mechanism, first draft:
QuickWidget implement base of sync mechanism with a sync property which can be overriden, and resync method which is called when resynchronisation is needed.
When resync is required, chat widget get missing occupant and history elements
A new callable argument can be used with historyPrint, when set it is called when history has been fully printed.
2019-03-10 18:03:11 +01:00
Goffi
060c985aba quick frontend (chat): new updateOccupants methods which add/remove occupants to be in sync with new list 2019-03-10 18:03:02 +01:00
Goffi
a89c506722 quick frontend(chat): added setLocked/setUnlocked methods:
those methods replace manual change of self._locked and manual creation/handling of caching.
2019-03-10 18:02:58 +01:00
Goffi
3830c1c176 quick frontend(chat): display a useful message with __unicode__ and __str__ 2019-03-10 18:02:54 +01:00
Goffi
38783d2c1b quick frontend(chat): use bare jid for getEncryptionState, and skip if for group chat 2019-03-03 20:59:29 +01:00
Goffi
db6a38c4fb quick frontend (chat): fixed use of old method printInfo 2019-01-19 23:27:22 +01:00
Goffi
8e338bf913 date update 2019-01-12 12:25:31 +01:00
Goffi
c2a1ba3793 core (xmpp): don't send message without message or subject to bridge (and log a warning in frontends if such a message is received) 2019-01-02 18:28:30 +01:00
Goffi
575b5dd126 quick frontend(chat): use unicode on jid.JID instance in self.host.bridge.messageEncryptionGet:
jid.JID is causing trouble when going trough bridge (with pb bridge), this patch avoid it by using unicode.
2018-12-27 11:40:04 +01:00
Goffi
1cb7461f99 quick frontend (app, chat): encryption handling:
- new QuickApp.ENCRYPTION_HANDLERS class attribute, if True (default), encryption handlers are set
- encryption plugins are retrieved on startup and cached in QuickApp.encryption_plugins list
- QuickChat's encrypted boolean attribute indicate if a session is currently encrypted. This is updated
  automatically if ENCRYPTION_HANDLERS is set
- if ENCRYPTION_HANDLERS is set, messageEncryptionStarted and messageEncryptionStopped are called when
  suitable.
2018-08-11 18:24:55 +02:00
Goffi
c1defc005d quick_frontend (chat): create target in cache if it is not found, avoiding an exception 2018-07-02 08:54:57 +02:00
Goffi
744cb0c503 code style reformatting using black 2018-06-27 20:14:46 +02:00
Goffi
90b8f4be32 quick frontend (chat): added a property to Message which is True when message comes from history 2018-05-10 08:34:44 +02:00
Goffi
80ef13612b core, setup: huge cleaning:
- moved directories from src and frontends/src to sat and sat_frontends, which is the recommanded naming convention
- move twisted directory to root
- removed all hacks from setup.py, and added missing dependencies, it is now clean
- use https URL for website in setup.py
- removed "Environment :: X11 Applications :: GTK", as wix is deprecated and removed
- renamed sat.sh to sat and fixed its installation
- added python_requires to specify Python version needed
- replaced glib2reactor which use deprecated code by gtk3reactor

sat can now be installed directly from virtualenv without using --system-site-packages anymore \o/
2018-04-02 19:44:50 +02:00
Renamed from frontends/src/quick_frontend/quick_chat.py (Browse further)