Commit graph libervia-backend/src/memory/memory.py
Author SHA1 Message Date
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
Goffi
7ffb8efb92 core (disco), plugin XEP-0115: client use + capabilities hash improvment:
- modified a couple of method from memory to use client instead of profile
- XEP-0115: don't use unique hash for all clients anymore, as disco can be different between clients/components, and even between clients (different identity for instance).
    hash is now generated per client on each new session.
2018-03-24 10:44:37 +01:00
Goffi
97f19b2e52 core (memory, sqlite): added fileUpdate method to update "extra" and "access" avoiding race condition 2018-03-16 17:03:46 +01:00
Goffi
d4ed57dadc core (memory): use bare jid for owner in setFiles:
this makes files unusable for MUCs private conversations, but it doesn't make much sense to use it in this case.
2018-03-14 08:07:24 +01:00
Goffi
c1dc9d4599 core (memory): fixed _getParentDir call in setFile 2018-03-02 17:37:41 +01:00
Goffi
db45d45be5 core (memory): file metadata handling methods:
- checkFilePermission check that requested permission(s) are granted for a file (without checking the parents)
- checkPermissionToRoot check that requested permission(s) are granted for a file and all its parents
- getFiles retrieve file(s) according to filter, and check permissions by default
- setFile create a file (and its parents if needed) and check permissions by default
2018-02-28 18:28:39 +01:00
Goffi
387c10cc0d dates update 2018-01-26 11:14:13 +01:00
Goffi
f5f25e8ab5 misc: date update (yes it's a bit late :p ) 2017-11-03 14:31:42 +01:00
Goffi
85f3bd5988 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
- profilesGetList now handles clients and components boolean arguments, to filter profiles
    - jp: added --clients and --components options to profile/list
    - profilesGetList now returns sorted profiles
2017-02-12 19:08:52 +01:00
Goffi
97337202cb core, jp: component handling + client handling refactoring:
- SàT can now handle components
    - plugin have now a "modes" key in PLUGIN_INFO where they declare if they can be used with clients and or components. They default to be client only.
    - components are really similar to clients, but with some changes in behaviour:
        * component has "entry point", which is a special plugin with a componentStart method, which is called just after component is connected
        * trigger end with a different suffixes (e.g. profileConnected vs profileConnectedComponent), so a plugin which manage both clients and components can have different workflow
        * for clients, only triggers of plugins handling client mode are launched
        * for components, only triggers of plugins needed in dependencies are launched. They all must handle component mode.
        * component have a sendHistory attribute (False by default) which can be set to True to allow saving sent messages into history
        * for convenience, "client" is still used in method even if it can now be a component
        * a new "component" boolean attribute tells if we have a component or a client
        * components have to add themselve Message protocol
        * roster and presence protocols are not added for components
        * component default port is 5347 (which is Prosody's default port)
    - asyncCreateProfile has been renamed for profileCreate, both to follow new naming convention and to prepare the transition to fully asynchronous bridge
    - createProfile has a new "component" attribute. When used to create a component, it must be set to a component entry point
    - jp: added --component argument to profile/create
    - disconnect bridge method is now asynchronous, this way frontends can know when disconnection is finished
    - new PI_* constants for PLUGIN_INFO values (not used everywhere yet)
    - client/component connection workflow has been moved to their classes instead of being a host methods
    - host.messageSend is now client.sendMessage, and former client.sendMessage is now client.sendMessageData.
    - identities are now handled in client.identities list, so it can be updated dynamically by plugins (in the future, frontends should be able to update them too through bridge)
    - profileConnecting* profileConnected* profileDisconnected* and getHandler now all use client instead of profile
2017-02-12 17:55:43 +01:00
Goffi
7ad14f2252 core: line feed (\n) are now forbidden in profile names 2016-08-28 20:09:09 +02:00
Goffi
9647e90943 backend (memory), frontends: improved history filtering:
a "filters" dictionnary is now use to filter, it can have, for now, filtering on:
        - "body": filter only on the body (equivalent to former "search" parameter, but not case sensitive)
        - "search": fitler on body + source resource
        - "types": allowed types
        - "not_types": forbidden types

    primitivus now do searching using "search", i.e. source resource is now taken into account (and search is now case insensitive)
2016-07-18 00:52:02 +02:00
Goffi
04515e5013 plugin XEP-0045, quick_frontend + primitivus (chat): cleaning of XEP-0045 (first pass):
- bridge methods/signals now all start with "muc" to follow new convention
    - internal method use client instead of profile to follow new convention
    - removed excetpions from plugin XEP-0045 in favor of core.exceptions, NotReady added
    - cleaned/simplified several part of the code. checkClient removed as it is not needed anymore
    - self.clients map removed, muc data are now stored directly in client
    - getRoomEntityNick and getRoomNicksOfUsers are removed as they don't look sane.
        /!\ This break all room game plugins for the moment
    - use of uuid4 instead of uuid1 for getUniqueName, as host ID and current time are used for uuid1
2016-06-27 21:45:11 +02:00
Goffi
a7de473107 backend, frontends: message refactoring (huge commit):
/!\ several features are temporarily disabled, like notifications in frontends

next step in refactoring, with the following changes:
    - jp: updated jp message to follow changes in backend/bridge
    - jp: added --lang, --subject, --subject_lang, and --type options to jp message + fixed unicode handling for jid
    - quick_frontend (QuickApp, QuickChat):
        - follow backend changes
        - refactored chat, message are now handled in OrderedDict and uid are kept so they can be updated
        - Message and Occupant classes handle metadata, so frontend just have to display them
    - Primitivus (Chat):
        - follow backend/QuickFrontend changes
        - info & standard messages are handled in the same MessageWidget class
        - improved/simplified handling of messages, removed update() method
        - user joined/left messages are merged when next to each other
        - a separator is shown when message is received while widget is out of focus, so user can quickly see the new messages
        - affiliation/role are shown (in a basic way for now) in occupants panel
        - removed "/me" messages handling, as it will be done by a backend plugin
        - message language is displayed when available (only one language per message for now)
        - fixed :history and :search commands
    - core (constants): new constants for messages type, XML namespace, entity type
    - core: *Message methods renamed to follow new code sytle (e.g. sendMessageToBridge => messageSendToBridge)
    - core (messages handling): fixed handling of language
    - core (messages handling): mes_data['from'] and ['to'] are now jid.JID
    - core (core.xmpp): reorganised message methods, added getNick() method to client.roster
    - plugin text commands: fixed plugin and adapted to new messages behaviour. client is now used in arguments instead of profile
    - plugins: added information for cancellation reason in CancelError calls
    - plugin XEP-0045: various improvments, but this plugin still need work:
        - trigger is used to avoid message already handled by the plugin to be handled a second time
        - changed the way to handle history, the last message from DB is checked and we request only messages since this one, in seconds (thanks Poezio folks :))
        - subject reception is waited before sending the roomJoined signal, this way we are sure that everything including history is ready
        - cmd_* method now follow the new convention with client instead of profile
        - roomUserJoined and roomUserLeft messages are removed, the events are now handled with info message with a "ROOM_USER_JOINED" info subtype
    - probably other forgotten stuffs :p
2016-06-20 18:41:53 +02:00
Goffi
f12803fa65 backend, frontend: messages refactoring (huge commit, not finished):
/!\ database schema has been modified, do a backup before updating

    message have been refactored, here are the main changes:

    - languages are now handled
    - all messages have an uid (internal to SàT)
    - message updating is anticipated
    - subject is now first class
    - new naming scheme is used newMessage => messageNew, getHistory => historyGet, sendMessage => messageSend
    - minimal compatibility refactoring in quick_frontend/Primitivus, better refactoring should follow
    - threads handling
    - delayed messages are saved into history
    - info messages may also be saved in history (e.g. to keep track of people joining/leaving a room)
    - duplicate messages should be avoided
    - historyGet return messages in right order, no need to sort again
    - plugins have been updated to follow new features, some of them need to be reworked (e.g. OTR)
    - XEP-0203 (Delayed Delivery) is now fully handled in core, the plugin just handle disco and creation of a delay element
    - /!\ jp and Libervia are currently broken, as some features of Primitivus

    It has been put in one huge commit to avoid breaking messaging between changes.
    This is the main part of message refactoring, other commits will follow to take profit of the new features/behaviour.
2016-05-24 22:11:04 +02:00
Goffi
6bbcbaf522 use of /usr/bin/env instead of /usr/bin/python in shebang 2016-04-17 14:45:26 +02:00
Goffi
8403bd61ae core (memory, config): moved parseMainConf to tools/config so it can be used by frontends too 2016-02-29 16:13:47 +01:00
Goffi
348be27934 copyright update 2016-01-03 16:28:30 +01:00
Goffi
d978e4918b core: avoid initialisation blocking when a long callback is added to backend.initialised (could prevent sessions starting) 2015-12-07 13:10:44 +01:00
Goffi
a3c15277bc core (memory): fixed bad memory cleaning on asyncDeleteProfile 2015-11-30 20:40:55 +01:00
Goffi
fad4200be3 core (memory): asyncCreateProfile fix: a fake session is created to set general password param 2015-11-27 16:52:14 +01:00
Goffi
1bf3950ce6 core (memory): profile is checked in startSession (an error is raised if it doesn't exist) 2015-11-27 16:50:29 +01:00
Goffi
3d8d66fa43 core (memory): stopSession implementation 2015-11-27 16:48:41 +01:00
Goffi
939b6ba80b core (memory): catch exceptions.UnknownEntityError in getMainResource 2015-11-26 17:00:18 +01:00
Goffi
95ad000f62 core (disco): disco hashes are now stored in database to avoid doing the same disco request on next load 2015-11-25 21:41:15 +01:00
Goffi
9c4ec1595c plugin XEP-0054: fixed vcard-update callback which was updating avatar when hash was empty, resulting in a really slow start 2015-11-25 20:01:39 +01:00
souliane
3fa1ea0376 memory: fixes asyncCreateProfile to not overwrite the personal key 2015-11-23 18:51:15 +01:00
Goffi
182f192703 core, bridge: added a profileSetDefault method 2015-11-14 19:18:10 +01:00
Goffi
e0a28858a8 core: profile session starting and connection are now separated. Moved profile session starting/authentication to memory module 2015-11-14 19:18:10 +01:00
Goffi
ce4e717ea8 core, bridge (params): added asyncGetParamsValuesFromCategory (yes that's a long name!) method to retrive params names and values for a given category 2015-11-14 19:18:10 +01:00
Goffi
bfd143b1e4 bridge, core(params): removed obsolete methods:
- getParams and getParamsForCategory are removed from bridge: XMLUI is now used in place of the old params XML
    - getParamsForCategory has also been removed internaly, as it is now unused, getParams is still used to construct the XMLUI
2015-11-14 19:18:07 +01:00
Goffi
76e571e18b plugin ip, params: plugin IP discovery, first draft:
- a dedicated plugin now manage IP discovery, for now it uses external website, but it should implement XEP-0279 soon
    - a permission is requested to user for calling an external website. Once the permission is granted (it's global), it is not asked anymore.
    - the ip is discovered on demand, and cache is kept for the session.
    - memory.params.getParamA has a new parameter use_default, which allow to get None when a parameter is not set, instead of the default value.
        This allow to detected when we need to do the first permission request. memory.getParamA don't have this parameter.
2015-09-29 17:54:22 +02:00
Goffi
74d91860ad core (memory, params): minor docstrings updates 2015-09-25 19:19:12 +02:00
Goffi
4623af2784 core (memory): fixed a double timer.cancel in Sessions 2015-08-18 10:36:41 +02:00
Goffi
0f10526746 core: getProfileName no raise ProfileUnknownError + minor doc fixes 2015-08-16 00:41:58 +02:00
Goffi
0a22619026 core (memory): Sessions fixes:
- avoid memory leak with forgotten _purgeSession in case of conflict: an exception is now raised instead
    - _purgeSession now cancel the timer if it was not done before
    - KeyError in profileGet is now explicitly raised throught a failure.Failure
    - use iterator to iterate session in ProfileSessions
2015-08-15 22:13:27 +02:00
souliane
67ff77e5de massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions 2015-04-16 14:57:57 +02:00
Goffi
fbec02d396 2015 copyright dates update 2015-03-30 10:26:26 +02:00
souliane
3bff0d0237 memory, plugin XEP-0045: getMainResource returns None when asking a MUC entity + fixes /whois on a MUC (bare) entity 2015-03-25 15:28:02 +01:00
Goffi
2900e815c4 core: if we are in dev version and it's possible, repository data are now checked and added to SàT version 2015-03-19 19:47:01 +01:00
Goffi
cdfb2c4dc6 core (memory): updateEntityData now accept a "silent" argument to avoid sending signal to frontends when updating an attribute with "signalOnUpdate" flag. 2015-02-09 21:39:51 +01:00
Goffi
ec25ba82e1 core: added getEntitiesData which get cache data for several entities at once 2015-02-09 21:39:51 +01:00
Goffi
8ce5c1862b core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
/!\ not finished, everything is still instable !
    - bridge: DBus bridge has been modified to allow blocking call to be called in the same way as asynchronous calls
    - bridge: calls with a callback and no errback are now possible, default errback log the error
    - constants: removed hack to manage presence without OrderedDict, as an OrderedDict like class has been implemented in Libervia
    - core: getLastResource has been removed and replaced by getMainResource (there is a global better management of resources)
    - various style improvments: use of constants when possible, fixed variable overlaps, import of module instead of direct class import
    - frontends: printInfo and printMessage methods in (Quick)Chat are more generic (use of extra instead of timestamp)
    - frontends: bridge creation and option parsing (command line arguments) are now specified by the frontend in QuickApp __init__
    - frontends: ProfileManager manage a more complete plug sequence (some stuff formerly manage in contact_list have moved to ProfileManager)
    - quick_frontend (quick_widgets): QuickWidgetsManager is now iterable (all widgets are then returned), or can return an iterator on a specific class (return all widgets of this class) with getWidgets
    - frontends: tools.jid can now be used in Pyjamas, with some care
    - frontends (XMLUI): profile is now managed
    - core (memory): big improvment on entities cache management (and specially resource management)
    - core (params/exceptions): added PermissionError
    - various fixes and improvments, check diff for more details
2015-01-24 01:00:29 +01:00
Goffi
05e5e1448b core: misc improvments:
- added some constants for message types and presence
    - removed profile authentification specific methods in favor of a more generic "validated" key
2014-12-10 18:36:11 +01:00
souliane
0da2c0228f memory: fixes issue in a test 2014-10-22 18:58:29 +02:00
souliane
92cb3c0503 memory: add method isContactConnected 2014-10-20 16:38:49 +02:00
souliane
e018212fb4 memory: temporary dirty hack to fix the personnal key issue after the auth session expired 2014-10-19 15:07:16 +02:00
souliane
2f6b8ae771 memory: don't save last resource in entity data for the MUC jids 2014-10-17 20:26:01 +02:00
Goffi
6b20989ecc core: better management of default value in getConfig 2014-10-07 17:12:41 +02:00
souliane
767f3d50dc bridge, memory: add "search" attribute to getHistory (filter the results with a unix globbing pattern) 2014-10-04 10:25:32 +02:00