summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2012-01-10 16:30:59 +0100
committerFlorent Le Coz <louiz@louiz.org>2012-01-10 16:30:59 +0100
commit5fee56440c10f81286699a4dd9e32506aa342d54 (patch)
tree8f577c41a90ab3649e209b2b7ce66af34ba34d59
parent62c4f67ea53c6b1c7f4092349f4c746e5bdb14f1 (diff)
downloadpoezio-5fee56440c10f81286699a4dd9e32506aa342d54.tar.gz
poezio-5fee56440c10f81286699a4dd9e32506aa342d54.tar.bz2
poezio-5fee56440c10f81286699a4dd9e32506aa342d54.tar.xz
poezio-5fee56440c10f81286699a4dd9e32506aa342d54.zip
Add a simple_notify plugin
And also fix some issues, like the split of the exec_command arguments. And the doc for the plugin, too.
-rw-r--r--doc/en/plugins/gpg.txt2
-rw-r--r--src/core.py5
-rwxr-xr-xsrc/daemon.py5
-rw-r--r--src/tabs.py3
4 files changed, 11 insertions, 4 deletions
diff --git a/doc/en/plugins/gpg.txt b/doc/en/plugins/gpg.txt
index 70a6fd15..a39b68a4 100644
--- a/doc/en/plugins/gpg.txt
+++ b/doc/en/plugins/gpg.txt
@@ -33,7 +33,7 @@ You need to create a plugin configuration file. Create a file named _gpg.cfg_
into your plugins configuration directory (_~/.config/poezio/plugins_ by
default), and fill it like this:
-[source,python]
+[source,conf]
---------------------------------------------------------------------
[gpg]
keyid = 091F9C78
diff --git a/src/core.py b/src/core.py
index 883eb8fa..1023c748 100644
--- a/src/core.py
+++ b/src/core.py
@@ -2164,7 +2164,10 @@ class Core(object):
self.remote_fifo = None
else:
e = Executor(command.strip())
- e.start()
+ try:
+ e.start()
+ except ValueError as e: # whenever shlex fails
+ self.information('%s' % (e,), 'Error')
def get_conversation_messages(self):
"""
diff --git a/src/daemon.py b/src/daemon.py
index b413f465..4b4c0b79 100755
--- a/src/daemon.py
+++ b/src/daemon.py
@@ -22,7 +22,7 @@ command on your local machine.
import sys
import threading
import subprocess
-
+import shlex
import logging
log = logging.getLogger(__name__)
@@ -40,7 +40,8 @@ class Executor(threading.Thread):
def run(self):
log.info('executing %s' % (self.command.strip(),))
- subprocess.call(self.command.split())
+ command = shlex.split(self.command)
+ subprocess.call(command)
def main():
while True:
diff --git a/src/tabs.py b/src/tabs.py
index 45860acc..8316d2a3 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -1318,6 +1318,7 @@ class MucTab(ChatTab):
Note that user can be None even if nickname is not None. It happens
when we receive an history message said by someone who is not
in the room anymore
+ Return True if the message highlighted us. False otherwise.
"""
self.log_message(txt, time, nickname)
user = self.get_user_by_name(nickname) if nickname is not None else None
@@ -1331,6 +1332,7 @@ class MucTab(ChatTab):
if self.state != 'highlight':
self.state = 'message'
nick_color = nick_color or None
+ highlight = False
if (not nickname or time) and not txt.startswith('/me '):
txt = '\x195}%s' % (txt,)
else: # TODO
@@ -1339,6 +1341,7 @@ class MucTab(ChatTab):
nick_color = highlight
time = time or datetime.now()
self._text_buffer.add_message(txt, time, nickname, nick_color, history, user)
+ return highlight
class PrivateTab(ChatTab):
"""