core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)

This commit is contained in:
Goffi 2018-02-28 18:28:39 +01:00
commit a89b5f0957

View file

@ -143,8 +143,27 @@ class Const(object):
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 @@ class Const(object):
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 @@ class Const(object):
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"]'