mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-07 01:27:12 +00:00
agent-msg-filter: Simplify code
Most of the time result is set to AGENT_MSG_FILTER_OK, set at the beginning and change if necessary. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
950e60db91
commit
ca7fe46a73
@ -82,35 +82,31 @@ data_to_read:
|
||||
if (filter->discard_all) {
|
||||
filter->result = AGENT_MSG_FILTER_DISCARD;
|
||||
} else {
|
||||
// default, easier to set once
|
||||
filter->result = AGENT_MSG_FILTER_OK;
|
||||
switch (msg_header.type) {
|
||||
case VD_AGENT_CLIPBOARD:
|
||||
case VD_AGENT_CLIPBOARD_GRAB:
|
||||
case VD_AGENT_CLIPBOARD_REQUEST:
|
||||
case VD_AGENT_CLIPBOARD_RELEASE:
|
||||
if (filter->copy_paste_enabled) {
|
||||
filter->result = AGENT_MSG_FILTER_OK;
|
||||
} else {
|
||||
if (!filter->copy_paste_enabled) {
|
||||
filter->result = AGENT_MSG_FILTER_DISCARD;
|
||||
}
|
||||
break;
|
||||
case VD_AGENT_FILE_XFER_START:
|
||||
case VD_AGENT_FILE_XFER_STATUS:
|
||||
case VD_AGENT_FILE_XFER_DATA:
|
||||
if (filter->file_xfer_enabled) {
|
||||
filter->result = AGENT_MSG_FILTER_OK;
|
||||
} else {
|
||||
if (!filter->file_xfer_enabled) {
|
||||
filter->result = AGENT_MSG_FILTER_DISCARD;
|
||||
}
|
||||
break;
|
||||
case VD_AGENT_MONITORS_CONFIG:
|
||||
if (filter->use_client_monitors_config) {
|
||||
filter->result = AGENT_MSG_FILTER_MONITORS_CONFIG;
|
||||
} else {
|
||||
filter->result = AGENT_MSG_FILTER_OK;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
filter->result = AGENT_MSG_FILTER_OK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user