aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-11-21 22:47:52 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2015-11-21 22:47:52 +0100
commit71f3532e04e5c76327363a3fd36b506f54e5043d (patch)
tree8ed10c749ba0b9a3db62e0150e739dfacddc811c
parentd135728424dad963f789f2362f794ee393a11823 (diff)
downloadxK-71f3532e04e5c76327363a3fd36b506f54e5043d.tar.gz
xK-71f3532e04e5c76327363a3fd36b506f54e5043d.tar.xz
xK-71f3532e04e5c76327363a3fd36b506f54e5043d.zip
degesch: add the first Lua plugin to distribution
This required separate plugin directories for both pluginized executables.
-rw-r--r--CMakeLists.txt11
-rw-r--r--config.h.in2
-rw-r--r--plugins/degesch/ping-timeout.lua33
-rwxr-xr-xplugins/zyklonb/coin (renamed from plugins/coin)0
-rwxr-xr-xplugins/zyklonb/eval (renamed from plugins/eval)0
-rwxr-xr-xplugins/zyklonb/pomodoro (renamed from plugins/pomodoro)0
-rwxr-xr-xplugins/zyklonb/script (renamed from plugins/script)0
-rwxr-xr-xplugins/zyklonb/youtube (renamed from plugins/youtube)0
-rw-r--r--zyklonb.c1
9 files changed, 41 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 64bb667..2e8a2f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,7 +94,8 @@ set (HAVE_EDITLINE "${WANT_LIBEDIT}")
set (HAVE_LUA "${WITH_LUA}")
include (GNUInstallDirs)
-set (plugin_dir ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
+# ZyklonB is currently an odd duck but degesch follows normal XDG rules
+set (zyklonb_plugin_dir ${CMAKE_INSTALL_LIBDIR}/zyklonb/plugins)
configure_file (${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
@@ -138,10 +139,10 @@ add_custom_target (clang-tidy
# Installation
install (TARGETS zyklonb degesch kike DESTINATION ${CMAKE_INSTALL_BINDIR})
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
-
-foreach (plugin coin eval script youtube ${plugins})
- install (FILES plugins/${plugin} DESTINATION ${plugin_dir})
-endforeach (plugin)
+install (DIRECTORY plugins/zyklonb/
+ DESTINATION ${zyklonb_plugin_dir} USE_SOURCE_PERMISSIONS)
+install (DIRECTORY plugins/degesch/
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/degesch/plugins)
# Generate documentation from program help
find_program (HELP2MAN_EXECUTABLE help2man)
diff --git a/config.h.in b/config.h.in
index 833f874..0ad9559 100644
--- a/config.h.in
+++ b/config.h.in
@@ -2,7 +2,7 @@
#define CONFIG_H
#define PROGRAM_VERSION "${project_VERSION}"
-#define PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${plugin_dir}"
+#define ZYKLONB_PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${zyklonb_plugin_dir}"
#cmakedefine HAVE_READLINE
#cmakedefine HAVE_EDITLINE
diff --git a/plugins/degesch/ping-timeout.lua b/plugins/degesch/ping-timeout.lua
new file mode 100644
index 0000000..72a754f
--- /dev/null
+++ b/plugins/degesch/ping-timeout.lua
@@ -0,0 +1,33 @@
+--
+-- ping-timeout.lua: ping timeout readability enhancement plugin
+--
+-- Copyright (c) 2015, Přemysl Janouch <p.janouch@gmail.com>
+--
+-- Permission to use, copy, modify, and/or distribute this software for any
+-- purpose with or without fee is hereby granted, provided that the above
+-- copyright notice and this permission notice appear in all copies.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+-- SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+-- OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+-- CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+--
+
+degesch.hook_irc (function (hook, server, line)
+ local start, timeout =
+ line:match ("^(:[^ ]* QUIT :Ping timeout:) (%d+) seconds$")
+ if not start then
+ return line
+ end
+
+ local minutes = timeout // 60
+ if minutes == 0 then
+ return line
+ end
+
+ local seconds = timeout % 60
+ return string.format ("%s %d minutes, %d seconds", start, minutes, seconds)
+end)
diff --git a/plugins/coin b/plugins/zyklonb/coin
index 65967ad..65967ad 100755
--- a/plugins/coin
+++ b/plugins/zyklonb/coin
diff --git a/plugins/eval b/plugins/zyklonb/eval
index 982d78b..982d78b 100755
--- a/plugins/eval
+++ b/plugins/zyklonb/eval
diff --git a/plugins/pomodoro b/plugins/zyklonb/pomodoro
index 8f30327..8f30327 100755
--- a/plugins/pomodoro
+++ b/plugins/zyklonb/pomodoro
diff --git a/plugins/script b/plugins/zyklonb/script
index 661fbb0..661fbb0 100755
--- a/plugins/script
+++ b/plugins/zyklonb/script
diff --git a/plugins/youtube b/plugins/zyklonb/youtube
index 5614860..5614860 100755
--- a/plugins/youtube
+++ b/plugins/zyklonb/youtube
diff --git a/zyklonb.c b/zyklonb.c
index 13a68e3..053130a 100644
--- a/zyklonb.c
+++ b/zyklonb.c
@@ -19,6 +19,7 @@
#include "config.h"
#define PROGRAM_NAME "ZyklonB"
+#define PLUGIN_DIR ZYKLONB_PLUGIN_DIR
#include "common.c"