Commit graph libervia-backend/src/memory/memory.py
Author SHA1 Message Date
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
souliane
4f339272b7 memory: add Parameter "Chat history limit" 2014-09-24 13:49:43 +02:00
souliane
4c61bf8fad memory: getHistory with limit=0 now returns an empty list, use limit=None to return all messages 2014-10-03 12:43:59 +02:00
souliane
1388ff8fac memory: session timeout won't be reset on each access if the Sessions() is called with resettable_timeout=False 2014-09-22 19:24:07 +02:00
souliane
ef7035a3ca memory: profileSessions.profileGetUnique was not resetting the timer 2014-09-22 18:42:54 +02:00
souliane
ccaa5412c5 memory: handle the case where an existing session ID is re-used for creating a new session 2014-09-22 20:26:40 +02:00
souliane
830b6d8ef6 memory: Sessions.newSession can be called with a forced session ID 2014-09-21 13:10:55 +02:00
Matteo Cypriani
71e29f5c44 misc: fixed some typos 2014-09-15 14:18:25 +02:00
souliane
e0f8d09bf2 memory (memory): delete profile session on profile deletion 2014-06-27 20:05:31 +02:00
souliane
94d36a7d3e memory: add helper methods encryptValue and decryptValue 2014-06-25 19:01:00 +02:00
souliane
76413b3679 memory, tools (config): move special config retrieval from memory to tools 2014-06-09 20:40:13 +02:00
souliane
90115df6f1 tools: add missing file src/tools/config.py 2014-05-23 10:03:33 +02:00
souliane
c68b147398 memory: auto-update configuration file with libervia's passphrase when migrating the database 2014-05-23 09:59:15 +02:00
souliane
0d28c03d27 core, memory, bridge: added profile password + password encryption:
/!\ This changeset updates the database version to 2 and modify the database content!

Description:
    - new parameter General / Password to store the profile password
    - profile password is initialized with XMPP password value, it is stored hashed
    - bridge methods asyncCreateProfile/asyncConnect takes a new argument "password" (default = "")
    - bridge method asyncConnect returns a boolean (True = connection already established, False = connection initiated)
    - profile password is checked before initializing the XMPP connection

    - new private individual parameter to store the personal encryption key of each profile
    - personal key is randomly generated and encrypted with the profile password
    - personal key is decrypted after profile authentification and stored in a Sessions instance
    - personal key is used to encrypt/decrypt other passwords when they need to be retrieved/modified

    - modifying the profile password re-encrypt the personal key
    - Memory.setParam now returns a Deferred (the bridge method "setParam" is unchanged)
    - Memory.asyncGetParamA eventually decrypts the password, Memory.getParamA would fail on a password parameter

TODO:
    - if profile authentication is OK but XMPP authentication is KO, prompt the user for another XMPP password
    - fix the method "registerNewAccount" (and move it to a plugin)
    - remove bridge method "connect", sole "asyncConnect" should be used
2014-05-07 16:02:23 +02:00
souliane
c9f4397000 memory: add class ProfileSessions based on Sessions 2014-05-10 17:37:32 +02:00
souliane
2e6420fb49 memory, jp: added jp commands to load/save parameters template 2014-05-04 18:43:54 +02:00
Goffi
ba103161d5 core (log): refactoring + twisted backend:
- configuration is now done with classes, so inheritance is possible
    - twisted backend now use twisted log methods
    - log not produced by SàT directly in twisted backend are captured by an observer (twistedObserver) and sent back to SàT logging chain, with the "twisted" logger.
    - \\default output use normal twistd output, except in debug mode where it add an stdout output in addition to the log file.
    - when log_colors = True, colors are enabled only where it's possible (tty out), when log_colors=force colors are always enabled.
    - fixed some bad log.xxx calls
2014-05-05 18:58:34 +02:00
souliane
4b8ba7a6f4 memory: fixes the method fixLocalDir for pid_dir and log_dir to use local_dir as default 2014-04-30 19:54:21 +02:00
Goffi
501bc92528 core: use of the new core.log module:
/!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
2014-04-19 19:19:19 +02:00
Goffi
56ed5f13a5 core(memory): fixed last resource 2014-03-28 19:11:00 +01:00
Goffi
95678d7967 core, plugin XEP-0115: discovery refactoring:
- hashing algorithm of XEP-0115 has been including in core
    - our own hash is still calculated by XEP-0115 and can be regenerated with XEP_0115.recalculateHash
    - old discovery methods have been removed. Now the following methods are used:
        - hasFeature: tell if a feature is available for an entity
        - getDiscoInfos: self explaining
        - getDiscoItems: self explaining
        - findServiceEntities: return all available items of an entity which given (category, type)
        - findFeaturesSet: search for a set of features in entity + entity's items
      all these methods are asynchronous, and manage cache automatically
    - XEP-0115 manage in a better way hashes, and now use a trigger for presence instead of monkey patch
    - new FeatureNotFound exception, when we want to do something which is not available
    - refactored client initialisation sequence, removed client.initialized Deferred
    - added constant APP_URL
    - test_plugin_xep_0033.py has been temporarly deactivated, the time to adapt it
    - lot of cleaning
2014-03-28 18:07:22 +01:00
Goffi
382d49a628 core (memory): entities cache improvments:
- entities cache is no more limited to bare jid
    - resources are now automatically updated in bare jid cache
2014-03-28 18:07:17 +01:00
souliane
1066fdb4eb memory: bug fix the current local_dir after sat.conf is auto-updated 2014-03-24 16:43:08 +01:00
souliane
3075585d9d core, memory: use XDG recommended paths as the defaults for the config and local directories 2014-03-23 22:43:43 +01:00
Goffi
6d768028d1 core: removed default_config:
- constants in core.default_config moved to core.constants
    - removed unused host.getConst and host.setConst
    - APP_NAME* used where it make sense
2014-03-22 17:48:10 +01:00
Goffi
c67faecba1 core: added IQ_SET to core.constants + getLastResource now manage correctly jid.JID 2014-03-22 13:42:59 +01:00
Goffi
005ec59a8a core: use of Const for profile_key + replaced '@DEFAULT@' default profile_key by '@NONE@' 2014-03-21 16:27:09 +01:00
Goffi
e689f6bb34 core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there 2014-03-21 16:08:11 +01:00
Goffi
9bd81494d1 core: minor docstring fixes 2014-03-21 15:03:51 +01:00
souliane
88baf0791b core (memory): asyncDeleteProfile can force the deletion of a profile, even if it's connected (when called from the backend only) 2014-03-03 15:37:49 +01:00
souliane
d158589881 core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile 2014-03-03 09:59:10 +01:00
Goffi
7aaea47da8 core (memory): added 'no' value management in configuration's booleans 2014-02-25 23:03:13 +01:00
Goffi
a280080563 core (sqlite): automatic database update:
- new Updater class check database consistency (by calculating a hash on the .schema), and updates base if necessary
    - database now has a version (1 for current, 0 will be for 0.3's database), for each change this version will be increased
    - creation statements and update statements are in the form of dict of dict with tuples. There is a help text at the top of the module to explain how it works
    - if we are on a development version, the updater try to update the database automaticaly (without deleting table or columns). The Updater.generateUpdateData method can be used to ease the creation of update data (i.e. the dictionary at the top, see the one for the key 1 for an example).
    - if there is an inconsistency, an exception is raised, and a message indicate the SQL statements that should fix the situation.
    - well... this is rather complicated, a KISS method would maybe have been better. The future will say if we need to simplify it :-/
    - new DatabaseError exception
2014-02-23 23:30:32 +01:00
souliane
24beb81688 misc: fix unnamed arguments in format strings 2014-02-17 14:58:26 +01:00
souliane
7ea4dca1b0 memory: bug fix to not register twice frontends parameters + added some tests for param update 2014-02-07 17:10:24 +01:00