# HG changeset patch # User Goffi # Date 1519838919 -3600 # Node ID d1df08c79a5d7916cf58feb2f0a890323ef0da52 # Parent 984792a451bce022d1e779d7b305a21b76f52f7a core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches) diff -r 984792a451bc -r d1df08c79a5d src/core/constants.py --- 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"]'