changeset 2494:d1df08c79a5d

core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
author Goffi <goffi@goffi.org>
date Wed, 28 Feb 2018 18:28:39 +0100
parents 984792a451bc
children 537a4a8075f8
files src/core/constants.py
diffstat 1 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/constants.py	Wed Feb 28 18:28:39 2018 +0100
+++ b/src/core/constants.py	Wed Feb 28 18:28:39 2018 +0100
@@ -143,8 +143,27 @@
     NS_DELAY = 'urn:xmpp:delay'
     NS_XHTML = 'http://www.w3.org/1999/xhtml'
 
+    ## Common XPath ##
+
+    IQ_GET = '/iq[@type="get"]'
+    IQ_SET = '/iq[@type="set"]'
+
     ## Directories ##
+
+    # directory for components specific data
+    COMPONENTS_DIR = u'components'
     CACHE_DIR = u'cache'
+    # files in file dir are stored for long term
+    # files dir is global, i.e. for all profiles
+    FILES_DIR = u'files'
+    # FILES_LINKS_DIR is a directory where files owned by a specific profile
+    # are linked to the global files directory. This way the directory can be
+    # shared per profiles while keeping global directory where identical files
+    # shared between different profiles are not duplicated.
+    FILES_LINKS_DIR = u'files_links'
+    # FILES_TMP_DIR is where profile's partially transfered files are put.
+    # Once transfer is completed, they are moved to FILES_DIR
+    FILES_TMP_DIR = u'files_tmp'
 
 
     ## Configuration ##
@@ -212,6 +231,7 @@
     PLUG_MODE_CLIENT = "client"
     PLUG_MODE_COMPONENT = "component"
     PLUG_MODE_DEFAULT = (PLUG_MODE_CLIENT,)
+    PLUG_MODE_BOTH = (PLUG_MODE_CLIENT, PLUG_MODE_COMPONENT)
 
     # names of widely used plugins
     TEXT_CMDS = 'TEXT-COMMANDS'
@@ -314,6 +334,24 @@
     HISTORY_LIMIT_NONE = -2
 
 
+    ## Progress error special values ##
+    PROGRESS_ERROR_DECLINED = u'declined'  # session has been declined by peer user
+
+
+    ## Files ##
+    FILE_TYPE_DIRECTORY = 'directory'
+    FILE_TYPE_FILE = 'file'
+
+
+    ## Permissions management ##
+    ACCESS_PERM_READ = u'read'
+    ACCESS_PERM_WRITE = u'write'
+    ACCESS_PERMS = {ACCESS_PERM_READ, ACCESS_PERM_WRITE}
+    ACCESS_TYPE_PUBLIC = u'public'
+    ACCESS_TYPE_WHITELIST = u'whitelist'
+    ACCESS_TYPES = (ACCESS_TYPE_PUBLIC, ACCESS_TYPE_WHITELIST)
+
+
     ## Misc ##
     SAVEFILE_DATABASE = APP_NAME_FILE + ".db"
     IQ_SET = '/iq[@type="set"]'