1
0
Fork 0
Commit Graph

216 Commits

Author SHA1 Message Date
Dominique Fuchs d6af025a46 Numoerous safe conversions implemented. Added additional Utility::convertSizeToDWORD for windows builds.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 11:33:20 +02:00
Dominique Fuchs 82fa10c227 Corrected namespace when calling convertSizetoUint
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 10:21:59 +02:00
Dominique Fuchs 46e0a05078 Renamed conversion function to make intention more clear. Also defaulted to 'controlled truncation' to not stupidly crash. TBD/TODO: Better handling for such things.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 02:20:24 +02:00
Samir Benmendil 5e3c2d2a96 Fix fullPath matching
Signed-off-by: Samir Benmendil <me@rmz.io>
2019-08-15 03:00:26 +01:00
Samir Benmendil 7a9b13a563 Manual exclude are anchored to _localPath by default
This makes a lot of sense, since there should be no file to be synced
outside of _localPath.

Signed-off-by: Samir Benmendil <me@rmz.io>
2019-08-15 03:00:26 +01:00
Samir Benmendil e27645cb00 Extract loadExcludeFile and use it when discovering new exclude files
Signed-off-by: Samir Benmendil <me@rmz.io>
2019-08-15 03:00:26 +01:00
Samir Benmendil 34fcb13e78 Never ignore .sync-exclude, even if excludeHidden
That is unless any of the parent folders is hidden.

Signed-off-by: Samir Benmendil <me@rmz.io>
2019-08-15 03:00:26 +01:00
Samir Benmendil 14279104ae Read .sync_exclude.lst in each subdirectory
Signed-off-by: Samir Benmendil <me@rmz.io>
2019-08-15 03:00:26 +01:00
Roeland Jago Douma b7d0e5672a
Merge branch 'master' into upstream/pr/6616 2018-10-31 13:51:34 +01:00
Roeland Jago Douma eb31e9205c
Merge branch 'master' into upstream/issues/6696-6610 2018-10-24 16:50:39 +02:00
Roeland Jago Douma 6b7328bb87
Merge branch 'master' into upstream/pr/6632 2018-10-23 22:48:34 +02:00
Roeland Jago Douma 9d9f96a685
Merge branch 'master' into upstream/pr/6615 2018-10-19 15:43:50 +02:00
kevin147147 e214234001
Rename README to README.md
Preview :)
2018-10-08 21:01:08 +02:00
kevin147147 54e58b51ab
Rename INSTALL to INSTALL.md
Preview :)
2018-10-08 20:57:34 +02:00
Markus Goetz 4f83bba829
Windows: Don't ignore files with FILE_ATTRIBUTE_TEMPORARY
Too many applications incorrectly use this attribute.

For #6696 #6610
2018-09-10 20:20:40 +02:00
Christian Kamm 3ec4fc6145
Update: Report on readdir() errors #6610 2018-09-10 14:33:36 +02:00
Olivier Goffart d202942a2c
Reconcile: When detecting a local move, keep the local mtime
https://github.com/owncloud/client/issues/6629#issuecomment-402450691
2018-09-09 21:38:10 +02:00
Christian Kamm 283c4b13a1
Log: Adjust update/reconcile log verbosity
Not having these enabled by default is causing significant extra back
and forth with reporters since they must manually use --logdebug for the
log to be useful.
2018-09-09 21:34:41 +02:00
Roeland Jago Douma a0c458d937
Fix output add E2E again
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-06-05 09:02:41 +02:00
Olivier Goffart 3e508329b5
csync_update: add the checksum in the discovery log
Issue #6414
2018-06-05 07:52:29 +02:00
Roeland Jago Douma c1171d700e
Merge pull request #322 from nextcloud/upstream/pr/6404
Excludes: Expand doc, Desktop.ini only in root folder
2018-06-04 17:13:23 +02:00
Olivier Goffart 5f30177bfc
CSync: Remove unused error codes
None of the removed ERRNO code were ever set.
So none of the removed error hapenned anymore
2018-06-04 15:41:38 +02:00
Olivier Goffart 15e93c8a31
CSync: reconcile never returns an error 2018-06-04 15:41:38 +02:00
Olivier Goffart be29fc2f69
csync: remove CSYNC_PARAM_ERROR
It does not make sense to report such error to the user.
Its goal was to show invalid use of the csync API, but this is now done
with asserts.
2018-06-04 15:41:38 +02:00
Olivier Goffart 0443f8dd4d
csync: Simplify csync_walk_local_tree/csync_walk_remote_tree
Small refactoring
2018-06-04 15:41:38 +02:00
Roeland Jago Douma 1262cbf4ef
Merge pull request #314 from nextcloud/upstream/pr/6373
Make sure ignored and conflict files show up in the issues tab even with partial local discovery
2018-06-02 20:20:19 +02:00
Christian Kamm 5f7fd7c551
Excludes: Expand doc, Desktop.ini only in root folder
The Desktop.ini exclude was added for 2.4 because we add such a file to
the synced folder on Windows. It doesn't need to cover subdirectories.
2018-05-16 20:29:12 +02:00
Christian Kamm 75194d1821
SyncEngine: Make "local discovery?" question available
Also fix the minor bug that was mentioned and add tests.
2018-05-16 16:46:40 +02:00
Christian Kamm 8077748c9d
slotFolderDiscovered: Fix 'local' always being false
It was unused, so no harm done.
2018-05-16 16:44:36 +02:00
Olivier Goffart b0f539fc1f
cmake: Remove references of now unused WITH_TESTING
Issue #6318
2018-05-16 13:00:17 +02:00
Daniel Nicoletti 16aa54ed64 Do not create new db entries when the remote tree does not have proper values 2018-04-09 13:23:52 +02:00
Daniel Nicoletti d93f7269b8 Properly mark encrypted files for removal 2018-04-09 13:23:52 +02:00
Daniel Nicoletti d3b6aacf3f Fix merging remote and local trees when e2e files are involved
When populating the tree from the filesystem we need to fill
the e2eMangledName from DB and we when trying to find another
match on the oposite tree we need to take in account that names
don't match and search with the mangled name information
2018-04-09 13:23:52 +02:00
Daniel Nicoletti 99117078f3 Remove table for e2e and add an e2eMangledName column (#169)
If the code was not complex enough syncing two tables
already started to give UNIQUE constrains errors on
simple sync operations, this also adds initial support
remote delete of an encrypted file
2018-02-12 12:50:51 +01:00
Tomaz Canabrava d24a1e542e Merge branch 'master' into clientSideEncryptionV3 2018-01-29 14:06:12 +01:00
Tomaz Canabrava f4a50e88f5 [CSE] Ignore renames for downloaded files.
- TODO: Fix the incorrect "filename has been removed" popup.
The file is not removed, just the popup shows.
2018-01-28 23:59:53 +01:00
Tomaz Canabrava d38e5e1529 [CSE] Bypass rename if it's e2e
The client tracks the files in server and locally, but the
names of the files differ in the server, but we do *not*
wanna rename the files to the server one, we wanna
keep it as is if it's an encrypted file.
2018-01-28 23:48:51 +01:00
Christian Kamm c1b5412c16 Exclude regex: Use named captures
My benchmarks show no performance difference.
2018-01-18 10:24:24 +01:00
Christian Kamm 4337e8532e Exclude matching: Speedup the full-path traversal case
Previously we'd use the full regex when the bname triggered a full-path
matching to take place. Now we have a simplified full-traversal regex
for this case that can be significantly faster to apply.

Triggered by #5017 but doesn't actually solve it.
2018-01-17 15:05:50 +01:00
Dominik Schmidt cbf470f17b Fix csync installation on windows 2018-01-13 13:58:17 +01:00
Olivier Goffart 437d45981e Remove unused c_strlist 2018-01-13 13:58:17 +01:00
Olivier Goffart 3ae327ea8e Modernize out CMakeLists.txt
Mainly uses target_include_directories instead of include_directories
so libraries public include directory get automatically added when adding
the target in target_link_library
2018-01-13 13:58:17 +01:00
Olivier Goffart 5d0aa5f039 Remove unused c_path 2018-01-13 13:58:17 +01:00
Olivier Goffart 41798cef18 Csync: remove some unused build system stuff 2018-01-13 13:58:17 +01:00
Olivier Goffart 1c11778693 Remove the unusued csync_file_locked_or_open test in csync_reconcile
It is unused. Also remove the corresponding error code
2018-01-13 13:58:17 +01:00
Olivier Goffart 3ddd4b6f16 Get rid of csync_log
We use Qt's debugging code everywhere
2018-01-13 13:58:17 +01:00
Olivier Goffart d948ed11a1 Csync: use QElapsedTimer and qCInfo instead of CSYNC_LOG and its own csync time function
This allow to remove all the csync time manipulation routne which are now unused
2018-01-13 13:58:17 +01:00
Olivier Goffart 257d8142b1 Build system: Get rid of QtVersionAbstraction.cmake
Use modern cmake with target_link_libraries and Qt5:: that
automatically add the include path and compile flags
2018-01-13 13:58:17 +01:00
Olivier Goffart 48c55b7d29 csync/std: don't build in a separate library
There is no need to create a static library for the csync/std file, just
put everything together in csync
2018-01-13 13:58:17 +01:00
Olivier Goffart 776bbbf7b1 Don't include sqlite3.h from headers
So that sqlite is not part of the public interface of csync
(and that the sqlite include path don't need to be passed when compiling
libsync or gui)
2018-01-13 13:58:17 +01:00
Olivier Goffart 9613f6437d Merge remote-tracking branch 'origin/2.4'
Conflicts:
	src/libsync/networkjobs.cpp
2018-01-11 10:46:50 +01:00
Christian Kamm 7d70f1becb Ignore files that can't be encoded for the filesystem
There's an upstream bug where QTextCodec::canEncode returns true even
though it should be false. This works around that issue and adds a test.

The original work was done in 72809ef5b1

See #6287, #5676, #5719
See https://bugreports.qt.io/browse/QTBUG-6925
2018-01-10 13:36:00 +01:00
Christian Kamm 585d2b20bd Exclude regex: Restore old matching on Windows #6245
Unfortunately matching behaved differently on Windows. This patch
restores the previous matching behavior but still uses the new regular
expression based matching.

Further work will hopefully unify the behavior between platforms without
breaking backwards compatibility.
2018-01-09 11:09:05 +01:00
Christian Kamm 51b662fdfe Minor logging additions
- Clearly mark local and remote discovery start, to make this searchable
even without --logdebug.
- Promote two messages from debug to info: The 'N entries read from db'
message is useful and the 'read from db but ignored' message is rare
and surprising - if there's a bug there we want to see what happened in
the logs.
2018-01-08 09:36:30 +01:00
Christian Kamm 3988f3ad77 GCC: Fix implicit-fallthrough warnings 2018-01-05 09:43:53 +01:00
Daniel Nicoletti a63d34f870 Prepend "nextcloud" for all logging categories
Thus making easier to exclude logging from kio, qt
and only enable "nextcloud.*"
2017-12-28 17:33:10 -02:00
Olivier Goffart 1940c2f9bf Exclude: Use Qt to load the exclude file
fopen does not work well with relative path tand forward slashes on windows
This fix the windows textexcludedfiles test.
And also make the code simpler.

Note that the 'trimmed' might be a behavior change, but i think it is ok
2017-12-15 19:16:20 +01:00
Christian Kamm a7c0cfc8eb Upload conflict files #4557
If the server has the 'uploadConflictFiles' capability conflict
files will be uploaded instead of ignored.

Uploaded conflict files have the following headers set during upload
  OC-Conflict: 1
  OC-ConflictBaseFileId: 172489174instanceid
  OC-ConflictBaseMtime: 1235789213
  OC-ConflictBaseEtag: myetag
when the data is available. Downloads accept the same headers in return
when downloading a conflict file.

In the absence of server support clients will identify conflict files
through the file name pattern and attempt to deduce the base fileid.
Base etag and mtime can't be deduced though.

The upload job for a new conflict file will be triggered directly from
the job that created the conflict file now. No second sync run is
necessary anymore.

This commit does not yet introduce a 'username' like identifier that
automatically gets added to conflict file filenames (to name the files
foo_conflict-Fred-1345.txt instead of just foo_conflict-1345.txt).
2017-12-15 18:03:53 +01:00
Christian Kamm 8eebc53728 Unify item type enum
Previously, there was csync_ftw_type_e and SyncFileItem::Type. Having
two enums lead to a bug where Type::Unknown == Type::File that went
unnoticed for a good while.

This patch keeps only a single enum.
2017-12-15 18:02:04 +01:00
Olivier Goffart b10edfecfc Workaround MSVC bug with enum in bitfield
MSVC stores the enum as signed in the bitfield (contrary to the C++ spec)
Which means that once we store a value such as SyncFileItem::DetailError
in a bitfield, we get a negative value back, then of course, further
comparison fails.
2017-12-15 14:18:45 +01:00
Olivier Goffart 4dc49ff3b0 SyncEngine: Recover when the PUT reply (or chunkin's MOVE) is lost
This can happen if the upload of a file is finished, but we just got
disconnected right before recieving the reply containing the etag.
So nothing was save din the DB, and we are not sure if the server
recieved the file properly or not. Further local update of the file
will cause a conflict.

In order to fix this, store the checksum of the uploading file in
the uploadinfo table of the local db (even if there is no chunking
involved).  And when we have a conflict, check that it is not because
of this situation by checking the entry in the uploadinfo table.

Issue #5106
2017-12-14 11:56:12 +01:00
Olivier Goffart f1b7d506ae csync_exclude: fix compilation of non-test builds 2017-12-08 09:43:26 +01:00
Olivier Goffart e25af4f0dc csync_exclude: Fix compile
csync_exclude.cpp:428:17: error: assigning to 'char *' from incompatible type 'const char *'
        bname = path;
                ^~~~

The C library's strrchr always return 'char*'
Only the C++'s std::strrchr has two overloads
2017-12-07 17:34:14 +01:00
Christian Kamm 287670c9d6 Excludes: Remove fnmatch codepath
Now all exclude patterns can be translated to regular expressions.
2017-12-07 14:38:21 +01:00
Christian Kamm 994f3bb644 Excludes: fnmatch doesn't treat '{' as special
Neither the documentation at
http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_13
nor the fnmatch source code in <glibc>/posix/fnmatch_loop.c points
toward { causing special matching behavior.
2017-12-07 14:38:21 +01:00
Christian Kamm e5c780ee19 Excludes: Translate full-path patterns to regex
Improves full matches by more than an order of magnitude
and also improves speed of traversal matches by roughly 20%,
judging by the check_csync_exclude performance test.
2017-12-07 14:38:21 +01:00
Christian Kamm 1c3d5ab158 Excludes: Introduce dir-only regex matches 2017-12-07 14:38:21 +01:00
Christian Kamm 5d668eca40 Excludes: Optimize Desktop.ini check 2017-12-07 14:38:21 +01:00
Christian Kamm 7ab127ad53 Excludes: Refactor for pending improvements
Make ExcludedFiles something that is instantiated outside of
the CSYNC context and then given to it as a hook.

ExcludedFiles still lives in csync_exclude and the internal
workings haven't been touched.
2017-12-07 14:38:21 +01:00
Olivier Goffart dd91f4a86e Merge remote-tracking branch 'origin/2.4'
Conflicts:
	src/csync/csync.cpp
2017-12-07 09:37:50 +01:00
Hefee 32f38dc5f8 fix typo error: occured-> occurred 2017-12-06 20:02:53 +01:00
Christian Kamm ceac18c554 Reconcile: Rename maps are consistent with update phase #6212
For duplicate file ids the update phase and reconcile phase determined
the rename mappings independently. If they disagreed (due to different
order of processing), complicated misbehavior would result.

This patch fixes it by letting reconcile try to use the mapping that the
update phase has computed first.
2017-12-06 16:42:11 +01:00
Christian Kamm 99f32dcb99 Clear csync rename mappings after reconcile
They were being preserved *across sync runs*.
2017-12-06 16:42:11 +01:00
Olivier Goffart ed5385faa3 Merge remote-tracking branch 'origin/2.4'
Conflicts:
	src/libsync/connectionvalidator.cpp
     	src/libsync/networkjobs.cpp
2017-12-05 15:58:13 +01:00
Olivier Goffart 72809ef5b1 csync_update: ignore remote files that cannot be encoded
This is mainly for linux, whose local is not UTF-8.
For example, in latin1, it is not possible to encode emoji or chinese character.
If there are such character in the filename, Qt would just save the file using
the replacement character ('?'). Then, on the next sync, client would rename
the files using this replacement character.

Avoid this by ignoring the files which cannot be downloaded because the
filename cannot be represented with the user's locale

Relates to issue #5676 and #5719
2017-11-23 12:51:28 +01:00
Christian Kamm aafe7c4732 Merge remote-tracking branch 'origin/2.4' 2017-11-20 11:54:56 +01:00
Christian Kamm e694ffcd03 PropagateDownload: Adjustments to skipping downloads #6153
Previously we required matching mtimes but that's actually
unnecessary when the question is about whether to skip the
download. We will still update the file's metadata.

Also, adjust behavior when the checksum is weak (Adler32):
in these cases we still depend on equal mtimes.
2017-11-16 13:31:54 +01:00
Christian Kamm 37c5612aee Discovery: Treat files starting with '.' as hidden #6145
This bug was introduced when strcmp(a, b) != 0 was accidentally
converted to a == b.
2017-11-08 12:53:46 +01:00
Christian Kamm 05c1bfb6cf Merge remote-tracking branch 'origin/2.4' 2017-10-27 10:29:31 +02:00
Christian Kamm 9c7ee6ef85 Reconcile: Rename handling fixes: duplicate file ids
When users share the same tree several times (say A/ and A/B/ are both
shared) the remote tree can have several entries that have the same
file id. This needs to be respected in rename detection.

Also adds several tests and fixes for issues noticed during testing.

See #6096
2017-10-24 10:54:23 +02:00
Christian Kamm e85a339d94 Local discovery: Use db instead of filesystem
We mostly trust the file watchers meaning that we don't re-scan the
local tree if we have done that recently and no file watcher events
have arrived. If the file watchers invalidate a subtree, we rescan
only that subtree.

Since we're not entirely sure the file watchers are reliable, we still
do full local discoveries regularly (1h by default). There is a config
file setting as well as an environment variable to control the interval.
2017-10-24 10:00:20 +02:00
Christian Kamm 90befac901 Rename detection: File size must be equal
Comparison of file sizes for potential conflicts was added in
0eb9401c62, but did not extend to checking
the file size in case of potential local moves.

This commit adds this check and adds tests for various move+change
scenarios.
2017-10-05 14:17:07 +02:00
Christian Kamm 43a26eb50a Excludes: Fix bug with escapes in the regex, add tests 2017-10-05 10:40:53 +02:00
Christian Kamm 99d406072f Excludes: optimize csync_is_windows_reserved_word 2017-10-05 10:19:48 +02:00
Markus Goetz 3a1a56c7ad Excludes: During directory traversal, use QRegularExpression
On Mac, this halves the time spent in csync_excluded_traversal
when using check_csync_excluded_performance. A similar performance
increase is seen on linux.
2017-10-05 10:19:48 +02:00
Olivier Goffart a52dff713b csync_rename: optimize lookup
Avoid many memory allocations in reconcile
2017-09-27 11:41:55 +02:00
Olivier Goffart 041c5e6d44 csync_reconcile: Optimize reconcile by avoiding alocations
Fix performence regression from commit d66c2b5fae
For every new file we would look up every parent directories. Allocating
a new QByteArreay for every parent riectory just to know if it is in the other
tree is wasting lots of CPU.
Use a ByteArrayRef trick, similar to QStringRef
2017-09-27 11:41:55 +02:00
Jocelyn Turcotte 54c522c861 SyncJournalDb: Reimplement the db_is_empty logic from csync
This reduces the initial sync local discovery time from
2.0 to 0.6 seconds in LargeSyncBench on my machine.
2017-09-26 11:03:23 +02:00
Jocelyn Turcotte a034ee894c Use SyncJournalDb in csync
This gets rid of the csync_statedb sqlite layer and use
the same code and same connection as the rest of the SyncEngine.

Missing functions are added to SyncJournalDb and change a few minor
things (like changing SyncJournalFileRecord::_modtime to be an int64
instead of a QDateTime, like it was in csync).
2017-09-26 11:03:23 +02:00
Olivier Goffart bf2b089c5c c_utf8_from_locale: optimize the UTF8 case on Linux
Avoid converting to a QString as an intermediate step
2017-09-25 10:35:28 +02:00
Olivier Goffart 3107e63040 csync: use a unordered_map for the FileMap
Saves more than 10% of csync_update on LargeSyncBench
2017-09-25 10:35:28 +02:00
Olivier Goffart d8206ccbc7 csync_update: fix assert
Amend 1dc44c0f62
2017-09-25 00:17:47 +02:00
Olivier Goffart 35f80bd439 csync_vio_local: merge readdir and stat in the same call
For the remote this was already done long time ago
For windows, this was already partially done

The goal is to avoid needless conversion of the path to local encoding.
2017-09-22 16:18:18 +02:00
Olivier Goffart 1dc44c0f62 csync_update/reconcile: replace CSYNC_LOG with qDebug/qInfo
CSYNC_LOG has quite an overhead as it uses vsprintf and it might
be run even if the category is disabled
2017-09-22 11:12:19 +02:00
Olivier Goffart aa322d41aa csync: remove unused type 2017-09-22 09:58:55 +02:00
Olivier Goffart 95d23b1914 RemotePermissions: Store in a class rather than in a QByteArray to save memory
Create a specific type that parses the permissions so we can store
it in a short rather than in a QByteArray

Note: in RemotePermissions::toString, we make sure the string is not
empty by adding a space, this was already existing before commit
e8f7adc7ca where it was removed by mistake.
2017-09-22 09:29:08 +02:00
Christian Kamm 53195b064a Conflicts: Upload them files if env variable says so
Set OWNCLOUD_UPLOAD_CONFLICT_FILES=1 to trigger this behavior.

Note that this is experimental and unsupported. The real feature is
likely to end up in 2.5.

Uploading conflict files is simply done by removing the pattern from
csync_exclude. The rest here deals with making the conflict notification
ui approximately work.

There are still some concerns about where an uploaded conflict file
appears in the sync protocol and issues list (it should be in both, but
is only in one of them currently!).

See #4557.
2017-09-19 11:45:38 +02:00
Jocelyn Turcotte 6e240a3e9c csync_update: Remove the check for csync_get_statedb_exists
This always returns true since _csync_statedb_is_empty also always
returns true. This function was initially intended to be a shortcut
in case the database doesn't contain any row, but has been broken since
27fb5d9128 and now won't return false
unless the statement fails.

The _last_db_return_error in _csync_detect_update would take care
of that code path in a more direct and clearer way anyway.
2017-09-18 14:00:52 +02:00
Jocelyn Turcotte a1f1775d15 Move SyncJournalDB to src/common 2017-09-18 14:00:52 +02:00
Jocelyn Turcotte bd25225045 Move non-csync-dependent parts of FileSystem to src/common
This keep the csync-dependent parts in src/libsync, slitting the namespace
over two files.
This will allow moving SyncJournalDB to src/common as well.
2017-09-18 14:00:52 +02:00
Jocelyn Turcotte bfacac8683 Remove the usage of phash in csync
Only store the path since they represent the same thing, and do the
phash conversion during DB lookup like done in libsync.
We could get rid of everything since we also have an index on the path
column, but since it's the primary key this makes the migration non-trivial.
2017-09-18 11:46:09 +02:00
Jocelyn Turcotte d66c2b5fae Replace the custom rbtree by a std::map 2017-09-18 11:46:09 +02:00
Jocelyn Turcotte 72e44ce3d7 csync: Keep the csync_file_stat_t instances created during discovery
Now that they use the same structure, avoid _csync_detect_update
having to recreate another instance and transfer everything manually.
Any instance created during discovery should now be used all the way
up to SyncEngine::treewalkFile.

This also makes sure that the path and types are properly set in that
object instead of having to pass everything as separate parameters.

This gets rid of csync_ftw_flags_e which was now converted from,
and to csync_ftw_type_e, already in the csync_file_stat_t.

Issue #1817
2017-09-18 11:46:09 +02:00
Christian Kamm 0b7ad2c804 Excludes: Allow escaping # #6012
Otherwise adding patterns that start with # are impossible to add, since
they get treated as comments. Also add this escaping for patterns added
in the ui.
2017-09-14 14:53:05 +02:00
Jocelyn Turcotte a18a601291 csync_statedb: (really) Make sure children of non-synced items aren't read from the DB
No tests are covering this and I reversed the original logic.
2017-09-07 10:26:19 +02:00
Jocelyn Turcotte 92fc50d4b0 csync_statedb: Make sure children of non-synced items aren't read from the DB
Fix a regression during C++ conversion from 704ca366b3
2017-09-07 10:17:58 +02:00
Jocelyn Turcotte 715b8c4683 Fix build after C++ conversion of csync
Use the same macro as in SyncFileItem for bitfields on enums.

Fixes #5993
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte b1bb7ec1a8 Use a C++ contructor and destructor for CSYNC
Merge csync_create and csync_init into the constructor and
replace csync_destroy with the destructor.

Also use a QByteArray for csync_s::root_perms and flatten
csync_rename_s as a rename sub-struct of csync_s since it
can now handle C++ types.
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte f6136dd036 Remove csync_s::replica
The only difference with csync_s::current is that it's
assigned the value of csync_s::local::type and
csync_s::remote::type, which never change. So might as
well only use the "current" field with constants.
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte cb49635231 Replace TREE_WALK_FILE with csync_file_stat_t
Just expose csync_file_stat_t since we don't need an abstraction layer
anymore. Also pass the nodes of both trees directly to the visitor
function.

Issue #1817
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte e8f7adc7ca Replace csync_vio_file_stat_t with csync_file_stat_t
Also move csync_normalize_etag to common/utility since we
don't need the char* function anymore.

Remove the single space file_stat->remotePerm codepath since
this won't be used in csync anymore since
8de3bda0b1.

Issue #1817
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte 704ca366b3 Make csync_file_stat_t public and partly convert to C++
This is the first commit trying to unify csync_file_stat_s,
csync_vio_file_stat_s and csync_tree_walk_file_s. Use QByteArray
and unique_ptr already since I'm not used to track memory allocations
and this will make the transition easier.

Issue #1817
2017-09-05 17:25:19 +02:00
Jocelyn Turcotte cf15cbf0b3 Move Utility to a new common static library
Now that csync builds as C++, this will avoid having to implement
functionalities needed by csync mandatorily in csync itself.

This library is built as part of libocsync and symbols exported
through it.
This requires a relicense of Utility as LGPL. All classes moved into
this library from src/libsync will need to be relicensed as well.
2017-09-05 17:25:19 +02:00
Jocelyn Turcotte 4e5898efd7 Compile almost all of csync as C++
This will allow us to unify data structures between csync and libsync.

Utility functions like csync_time and c_std are still compiled as C
since we won't need to be coupled with Qt in the short term.
2017-08-22 15:22:56 +02:00
Jocelyn Turcotte a512586140 Use .cpp for existing csync .cc files
Make this consistent with the rest of the client code.
2017-08-22 11:18:22 +02:00
Jocelyn Turcotte 28a0971cdf Move csync to src/csync 2017-08-22 11:18:22 +02:00