Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gajim
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
219
Issues
219
List
Boards
Labels
Milestones
Merge Requests
25
Merge Requests
25
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gajim
gajim
Commits
2257da6c
Commit
2257da6c
authored
Sep 05, 2019
by
Daniel Brötzmann
Committed by
Philipp Hörist
Sep 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CommandSystem: Add setting to disable execution of commands by default
parent
911aaa1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
gajim/command_system/implementation/execute.py
gajim/command_system/implementation/execute.py
+19
-6
gajim/common/config.py
gajim/common/config.py
+1
-0
No files found.
gajim/command_system/implementation/execute.py
View file @
2257da6c
...
@@ -37,9 +37,14 @@ from os.path import expanduser
...
@@ -37,9 +37,14 @@ from os.path import expanduser
from
gi.repository
import
GLib
from
gi.repository
import
GLib
from
gajim.common
import
app
from
gajim.common.i18n
import
_
from
gajim.common.i18n
import
_
from
gajim.command_system.framework
import
CommandContainer
,
command
,
doc
from
gajim.command_system.framework
import
CommandContainer
from
gajim.command_system.implementation.hosts
import
ChatCommands
,
PrivateChatCommands
,
GroupChatCommands
from
gajim.command_system.framework
import
command
from
gajim.command_system.framework
import
doc
from
gajim.command_system.implementation.hosts
import
ChatCommands
from
gajim.command_system.implementation.hosts
import
PrivateChatCommands
from
gajim.command_system.implementation.hosts
import
GroupChatCommands
class
Execute
(
CommandContainer
):
class
Execute
(
CommandContainer
):
AUTOMATIC
=
True
AUTOMATIC
=
True
...
@@ -57,10 +62,18 @@ class Execute(CommandContainer):
...
@@ -57,10 +62,18 @@ class Execute(CommandContainer):
@
classmethod
@
classmethod
def
spawn
(
cls
,
processor
,
expression
):
def
spawn
(
cls
,
processor
,
expression
):
pipes
=
dict
(
stdout
=
PIPE
,
stderr
=
PIPE
)
command_system_execute
=
app
.
config
.
get
(
'command_system_execute'
)
directory
=
expanduser
(
cls
.
DIRECTORY
)
if
command_system_execute
:
popen
=
Popen
(
expression
,
shell
=
True
,
cwd
=
directory
,
**
pipes
)
pipes
=
dict
(
stdout
=
PIPE
,
stderr
=
PIPE
)
cls
.
monitor
(
processor
,
popen
)
directory
=
expanduser
(
cls
.
DIRECTORY
)
popen
=
Popen
(
expression
,
shell
=
True
,
cwd
=
directory
,
**
pipes
)
cls
.
monitor
(
processor
,
popen
)
else
:
processor
.
echo_error
(
_
(
'Command disabled. This command can be enabled by '
'setting
\'
command_system_execute
\'
to True in ACE '
'(Advanced Configuration Editor).'
))
return
@
classmethod
@
classmethod
def
monitor
(
cls
,
processor
,
popen
):
def
monitor
(
cls
,
processor
,
popen
):
...
...
gajim/common/config.py
View file @
2257da6c
...
@@ -288,6 +288,7 @@ class Config:
...
@@ -288,6 +288,7 @@ class Config:
'muclumbus_api_http_uri'
:
[
opt_str
,
'https://search.jabbercat.org/api/1.0/search'
],
'muclumbus_api_http_uri'
:
[
opt_str
,
'https://search.jabbercat.org/api/1.0/search'
],
'muclumbus_api_pref'
:
[
opt_str
,
'http'
,
_
(
'API Preferences. Possible values:
\'
http
\'
,
\'
iq
\'
'
)],
'muclumbus_api_pref'
:
[
opt_str
,
'http'
,
_
(
'API Preferences. Possible values:
\'
http
\'
,
\'
iq
\'
'
)],
'auto_copy'
:
[
opt_bool
,
True
,
_
(
'Selecting text will copy it to the clipboard'
)],
'auto_copy'
:
[
opt_bool
,
True
,
_
(
'Selecting text will copy it to the clipboard'
)],
'command_system_execute'
:
[
opt_bool
,
False
,
_
(
'If enabled, Gajim will execute commands (/show, /sh, /execute, /exec).'
)],
},
{})
# type: Tuple[Dict[str, List[Any]], Dict[Any, Any]]
},
{})
# type: Tuple[Dict[str, List[Any]], Dict[Any, Any]]
__options_per_key
=
{
__options_per_key
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment