diff options
author | David Robillard <d@drobilla.net> | 2012-03-12 02:28:21 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-03-12 02:28:21 +0000 |
commit | e9d9569271ee962c09ab66c6babed1ca5655a6c6 (patch) | |
tree | f77142b08c2bf2488eb382e993da1477c0b94307 /src/server/events/Move.cpp | |
parent | 7835b3d8c9b5b4a6f4959f56083d62826e6f7b8e (diff) | |
download | ingen-e9d9569271ee962c09ab66c6babed1ca5655a6c6.tar.gz ingen-e9d9569271ee962c09ab66c6babed1ca5655a6c6.tar.bz2 ingen-e9d9569271ee962c09ab66c6babed1ca5655a6c6.zip |
Unify event response mechanism and make it more appropriate for wire transmission.
The downside being more cryptic error messages until the client side error reporting stuff gets more fancy, but the important part is that belongs client side.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4053 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events/Move.cpp')
-rw-r--r-- | src/server/events/Move.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index 3991e636..878f21f0 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -58,19 +58,19 @@ Move::pre_process() Glib::RWLock::WriterLock lock(_engine.engine_store()->lock()); if (!_old_path.parent().is_parent_of(_new_path)) { - _error = PARENT_DIFFERS; + _status = PARENT_DIFFERS; Event::pre_process(); return; } _store_iterator = _engine.engine_store()->find(_old_path); if (_store_iterator == _engine.engine_store()->end()) { - _error = OBJECT_NOT_FOUND; + _status = NOT_FOUND; Event::pre_process(); return; } if (_engine.engine_store()->find_object(_new_path)) { - _error = OBJECT_EXISTS; + _status = EXISTS; Event::pre_process(); return; } @@ -115,22 +115,9 @@ Move::execute(ProcessContext& context) void Move::post_process() { - string msg = "Unable to rename object - "; - - if (_error == NO_ERROR) { - respond_ok(); + respond(_status); + if (!_status) { _engine.broadcaster()->move(_old_path, _new_path); - } else { - if (_error == OBJECT_EXISTS) - msg.append("Object already exists at ").append(_new_path.str()); - else if (_error == OBJECT_NOT_FOUND) - msg.append("Could not find object ").append(_old_path.str()); - else if (_error == OBJECT_NOT_RENAMABLE) - msg.append(_old_path.str()).append(" is not renamable"); - else if (_error == PARENT_DIFFERS) - msg.append(_new_path.str()).append(" is a child of a different patch"); - - respond_error(msg); } } |