.000075500017500000144000000000001250166277200113025ustar00gberusers00000000000000xwrited-2/data000075500017500000144000000000001232727125200136765ustar00gberusers00000000000000xwrited-2/data/docbook-update-source-data.xsl000064400017500000144000000015111232727124600216130ustar00gberusers00000000000000 xwrited-2/data/xwrited.desktop.in000064400017500000144000000002671232727124600174530ustar00gberusers00000000000000[Desktop Entry] Encoding=UTF-8 _Name=xwrited _Comment=Display write and wall messages as desktop notifications Exec=xwrited Terminal=false Type=Application Categories=System;Monitor; xwrited-2/data/xwrited.1.xml000064400017500000144000000115031232727124600163270ustar00gberusers00000000000000 Guido Berhoerster guido+xwrited@berhoerster.name 27 April, 2014 xwrited 1 User Commands xwrited display write and wall messages as desktop notifications sencrypt Description The xwrited utility displays write1 and wall1 messages as desktop notifications. A notification daemon compliant to the freedesktop.org Desktop Notification Specification draft needs to be running in order to display the notifications. Options The following options are supported: Print a summary of all command line options and exit. Enable debugging output. Print the version number and exit. Exit Status The following exit values are returned: 0 Command successfully executed. > 0 An error has occured. See Also write 1, wall1 Notes xwrited assumes that messages are encoded in UTF-8 because there is no way for it to determine the character set encoding of the received data. xwrited-2/xwrited-utmp.h000064400017500000144000000025111232724642000156640ustar00gberusers00000000000000/* * Copyright (C) 2010 Guido Berhoerster * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XWRITED_UTMP_H #define XWRITED_UTMP_H #include G_BEGIN_DECLS void xwrited_utmp_add_entry(int); void xwrited_utmp_remove_entry(int); G_END_DECLS #endif /* XWRITED_UTMP_H */ xwrited-2/xwrited-debug.h000064400017500000144000000024501232724642000157670ustar00gberusers00000000000000/* * Copyright (C) 2011 Guido Berhoerster * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XWRITED_DEBUG_H #define XWRITED_DEBUG_H #include G_BEGIN_DECLS void xwrited_debug_init(gboolean); G_END_DECLS #endif /* XWRITED_DEBUG_H */ xwrited-2/main.c000064400017500000144000000317521250164675600141550ustar00gberusers00000000000000/* * Copyright (C) 2015 Guido Berhoerster * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define _XOPEN_SOURCE 600 #include #include #include #include #include #include #include #include #include #include #include #include #include #include "xwrited-debug.h" #include "xwrited-unique.h" #include "xwrited-utmp.h" #define BUFFER_TIMEOUT (250) enum { PIPE_R_FD = 0, PIPE_W_FD }; static int signal_pipe_fd[2] = { -1, -1 }; static guint notify_timeout_id; static GMainLoop *loop; static GString *buffer; static void on_signal(int signo) { int old_errno = errno; ssize_t n; sigset_t sigset; /* try to read unread signals from the pipe and add the new one to it */ n = read(signal_pipe_fd[PIPE_R_FD], &sigset, sizeof (sigset)); if ((n == -1) || ((size_t)n < sizeof (sigset))) { sigemptyset(&sigset); } sigaddset(&sigset, signo); write(signal_pipe_fd[PIPE_W_FD], &sigset, sizeof (sigset)); errno = old_errno; } static gboolean signal_read_cb(GIOChannel *source, GIOCondition cond, gpointer user_data) { sigset_t sigset; sigset_t old_sigset; GIOStatus status; gsize n; GError *error = NULL; /* * deal with pending signals previously received in the signal handler, * try to read a sigset from the pipe, avoid partial reads by blocking * all signals during the read operation */ sigfillset(&sigset); sigprocmask(SIG_BLOCK, &sigset, &old_sigset); status = g_io_channel_read_chars(source, (gchar *)&sigset, sizeof (sigset), &n, &error); sigprocmask(SIG_SETMASK, &old_sigset, NULL); if (status != G_IO_STATUS_NORMAL) { if (status != G_IO_STATUS_AGAIN) { if (error != NULL) { g_critical("failed to read from signal pipe: " "%s", error->message); g_error_free(error); g_main_loop_quit(loop); } else { g_critical("failed to read from signal pipe"); g_main_loop_quit(loop); } } } else if (n != sizeof (sigset)) { g_critical("short read from signal pipe"); g_main_loop_quit(loop); } else { if ((sigismember(&sigset, SIGINT) == 1) || (sigismember(&sigset, SIGTERM) == 1) || (sigismember(&sigset, SIGQUIT) == 1) || (sigismember(&sigset, SIGHUP) == 1)) { g_debug("received signal, exiting"); g_main_loop_quit(loop); } } return (TRUE); } static gboolean send_notification(void) { gboolean retval = FALSE; GString *utf8_str = NULL; gchar *startp = buffer->str; gchar *endp; GRegex *regex = NULL; GError *error = NULL; gchar *body = NULL; GList *capabilities = NULL; gchar *tmp; NotifyNotification *notification = NULL; utf8_str = g_string_sized_new(buffer->len); while (!g_utf8_validate(startp, buffer->str + buffer->len - startp, (const gchar **)&endp)) { g_string_append_len(utf8_str, startp, endp - startp); /* * replace each byte that does not belong to a UTF-8-encoded * character with the Unicode REPLACEMENT CHARACTER (U+FFFD) */ g_string_append(utf8_str, "\357\277\275"); startp = endp + ((endp < buffer->str + buffer->len) ? 1 : 0); } g_string_append_len(utf8_str, startp, buffer->str + buffer->len - startp); /* remove any CR, BEL and trailing space and tabs */ regex = g_regex_new("([\r\a]+|[ \t\r\a]+$)", G_REGEX_MULTILINE, 0, &error); if (error != NULL) { g_critical("failed to create regex object: %s", error->message); g_error_free(error); goto out; } body = g_regex_replace_literal(regex, utf8_str->str, -1, 0, "", 0, &error); if (error != NULL) { g_critical("failed to replace control and space characters: " "%s", error->message); g_error_free(error); goto out; } /* * skip empty messages or messages only consisting of whitespace and * control characters */ if ((strlen(body) == 0) || !g_regex_match_simple("[^[:space:][:cntrl:]]", body, 0, 0)) { retval = TRUE; goto out; } /* * if the notification daemon supports markup the message needs to be * escaped */ capabilities = notify_get_server_caps(); if (g_list_find_custom(capabilities, "body-markup", (GCompareFunc)strcmp) != NULL) { tmp = g_markup_escape_text(body, -1); g_free(body); body = tmp; } /* show notification */ notification = notify_notification_new(_("Message received"), body, "utilities-terminal" #if !defined(NOTIFY_VERSION_MINOR) || \ (NOTIFY_VERSION_MAJOR == 0 && NOTIFY_VERSION_MINOR < 7) , NULL #endif ); if (notification == NULL) { g_critical("failed to create a notification object"); g_main_loop_quit(loop); goto out; } notify_notification_set_timeout(notification, NOTIFY_EXPIRES_NEVER); retval = notify_notification_show(notification, NULL); out: if (notification != NULL) { g_object_unref(G_OBJECT(notification)); } if (capabilities != NULL) { g_list_free_full(capabilities, g_free); } g_free(body); if (regex != NULL) { g_regex_unref(regex); } if (utf8_str != NULL) { g_string_free(utf8_str, TRUE); } /* prevent a permanently large buffer */ g_string_free(buffer, FALSE); buffer = g_string_sized_new(BUFSIZ); return (retval); } static gboolean notify_timeout_cb(gpointer user_data) { if (!send_notification()) { g_warning("failed to send notification"); } notify_timeout_id = 0; return (FALSE); } static gboolean master_pty_read_cb(GIOChannel *source, GIOCondition cond, gpointer user_data) { gchar buf[BUFSIZ]; GIOStatus status; gsize buf_len; GError *error = NULL; if ((cond & G_IO_IN) || (cond & G_IO_PRI)) { /* read message from master pty */ while ((status = g_io_channel_read_chars(source, buf, BUFSIZ, &buf_len, &error)) == G_IO_STATUS_NORMAL) { if (buf_len > 0) { g_debug("read %" G_GSSIZE_FORMAT " bytes from " "master pty", buf_len); g_string_append_len(buffer, buf, (gssize)buf_len); } } if (error != NULL) { g_critical("failed to read from master pty: %s", error->message); g_error_free(error); g_main_loop_quit(loop); return (FALSE); } /* * schedule a timeout for sending a notification with the * buffered message */ if (notify_timeout_id <= 0) { notify_timeout_id = g_timeout_add(BUFFER_TIMEOUT, notify_timeout_cb, NULL); } } if ((cond & G_IO_ERR) || (cond & G_IO_HUP)) { g_critical("connection to master pty broken"); g_main_loop_quit(loop); return (FALSE); } return (TRUE); } int main(int argc, char *argv[]) { int status = EXIT_FAILURE; GError *error = NULL; XWritedUnique *app = NULL; GOptionContext *context = NULL; struct sigaction sigact; GIOChannel *signal_channel = NULL; GIOChannel *master_pty_channel = NULL; int masterfd = -1; int slavefd = -1; char *slave_name = NULL; gboolean vflag = FALSE; gboolean dflag = FALSE; const GOptionEntry options[] = { { "debug", 'd', 0, G_OPTION_ARG_NONE, &dflag, N_("Show extra debugging information"), NULL }, { "version", 'V', 0, G_OPTION_ARG_NONE, &vflag, N_("Print the current version and exit"), NULL }, { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, 0 } }; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); textdomain(PACKAGE); #if !GLIB_CHECK_VERSION(2, 35, 0) /* deprecated in glib >= 2.35 */ g_type_init(); #endif context = g_option_context_new("- display write and wall messages as " "desktop notifications"); g_option_context_add_main_entries(context, options, PACKAGE); g_option_context_set_translation_domain(context, PACKAGE); g_option_context_parse(context, &argc, &argv, &error); if (error != NULL) { g_printerr("%s.\n", error->message); g_error_free(error); goto out; } xwrited_debug_init(dflag); if (vflag) { g_print("%s %s\n", PACKAGE, VERSION); status = EXIT_SUCCESS; goto out; } app = xwrited_unique_new("org.guido-berhoerster.code.xwrited"); if (app == NULL) { g_critical("failed to initialize application"); goto out; } if (!xwrited_unique_is_unique(app)) { g_printerr(_("xwrited is already running in this session.\n")); goto out; } if (!notify_init(APP_NAME)) { g_critical("failed to initialize libnotify"); goto out; } loop = g_main_loop_new(NULL, FALSE); if (loop == NULL) { g_critical("failed to create main loop"); goto out; } buffer = g_string_sized_new(BUFSIZ); /* open master pty */ masterfd = posix_openpt(O_RDWR | O_NOCTTY); if (masterfd == -1) { g_critical("failed to open master pty: %s", g_strerror(errno)); goto out; } /* create slave pty */ if ((grantpt(masterfd) == -1) || (unlockpt(masterfd) == -1)) { g_critical("failed to create slave pty: %s", g_strerror(errno)); goto out; } slave_name = ptsname(masterfd); if (slave_name == NULL) { g_critical("failed to obtain name of slave pty"); goto out; } /* * keep an open fd around order to prevent closing the master fd when * receiving an EOF */ slavefd = open(slave_name, O_RDWR); if (slavefd == -1) { g_critical("failed to open slave pty: %s", g_strerror(errno)); goto out; } /* create a GIOChannel for monitoring the master pty for messages */ master_pty_channel = g_io_channel_unix_new(masterfd); g_io_channel_set_flags(master_pty_channel, g_io_channel_get_flags(master_pty_channel) | G_IO_FLAG_NONBLOCK, &error); if (error != NULL) { g_critical("failed set flags on the master pty channel: %s", error->message); g_error_free(error); goto out; } if (!g_io_add_watch(master_pty_channel, G_IO_IN | G_IO_PRI | G_IO_HUP | G_IO_ERR, master_pty_read_cb, NULL)) { g_critical("failed to add watch on signal channel"); goto out; } /* create pipe for delivering signals to a listener in the main loop */ if (pipe(signal_pipe_fd) == -1) { g_critical("failed to create signal pipe: %s", g_strerror(errno)); goto out; } if (fcntl(signal_pipe_fd[PIPE_W_FD], F_SETFL, O_NONBLOCK) == -1) { g_critical("failed to set flags on signal pipe: %s", g_strerror(errno)); goto out; } /* create GIO channel for reading from the signal_pipe */ signal_channel = g_io_channel_unix_new(signal_pipe_fd[PIPE_R_FD]); g_io_channel_set_encoding(signal_channel, NULL, &error); if (error != NULL) { g_critical("failed to set binary encoding for signal channel: " "%s", error->message); g_error_free(error); goto out; } g_io_channel_set_buffered(signal_channel, FALSE); g_io_channel_set_flags(signal_channel, g_io_channel_get_flags(signal_channel) | G_IO_FLAG_NONBLOCK, &error); if (error != NULL) { g_critical("failed set flags on signal channel: %s", error->message); g_error_free(error); goto out; } if (g_io_add_watch(signal_channel, G_IO_IN | G_IO_PRI | G_IO_HUP | G_IO_ERR, signal_read_cb, NULL) == 0) { g_critical("failed to add watch on the signal channel"); goto out; } /* set up signal handler */ sigact.sa_handler = on_signal; sigact.sa_flags = SA_RESTART; sigemptyset(&sigact.sa_mask); if ((sigaction(SIGINT, &sigact, NULL) < 0) || (sigaction(SIGTERM, &sigact, NULL) < 0) || (sigaction(SIGQUIT, &sigact, NULL) < 0) || (sigaction(SIGHUP, &sigact, NULL) < 0)) { g_critical("failed to set up signal handler"); goto out; } xwrited_utmp_add_entry(masterfd); /* main loop */ g_main_loop_run(loop); xwrited_utmp_remove_entry(masterfd); status = EXIT_SUCCESS; out: if (context != NULL) { g_option_context_free(context); } if (signal_channel != NULL) { g_io_channel_shutdown(signal_channel, FALSE, NULL); g_io_channel_unref(signal_channel); } if (signal_pipe_fd[PIPE_R_FD] != -1) { close(signal_pipe_fd[PIPE_R_FD]); } if (signal_pipe_fd[PIPE_W_FD] != -1) { close(signal_pipe_fd[PIPE_W_FD]); } if (master_pty_channel != NULL) { g_io_channel_shutdown(master_pty_channel, FALSE, NULL); g_io_channel_unref(master_pty_channel); } if (slavefd != -1) { close(slavefd); } if (masterfd != -1) { close(masterfd); } if (buffer != NULL) { g_string_free(buffer, FALSE); } if (app != NULL) { g_object_unref(app); } if (loop != NULL) { g_main_loop_unref(loop); } if (notify_is_initted()) { notify_uninit(); } exit(status); } xwrited-2/xwrited-debug.c000064400017500000144000000044451232727124600157740ustar00gberusers00000000000000/* * Copyright (C) 2014 Guido Berhoerster * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define _XOPEN_SOURCE 600 #include #include #include #include "xwrited-debug.h" #if !GLIB_CHECK_VERSION(2, 32, 0) static void dummy_log_handler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer data) { /* drop all messages */ } #endif /* !GLIB_CHECK_VERSION (2,32,0) */ void xwrited_debug_init(gboolean debug_mode) { /* * glib >= 2.32 only shows debug messages if the G_MESSAGES_DEBUG * environment variable contains the log domain or "all", earlier glib * version always show debugging output */ #if GLIB_CHECK_VERSION(2, 32, 0) const gchar *debug_env; gchar *debug_env_new; if (debug_mode) { debug_env = g_getenv("G_MESSAGES_DEBUG"); if (debug_env == NULL) { g_setenv("G_MESSAGES_DEBUG", G_LOG_DOMAIN, TRUE); } else if (strstr(debug_env, G_LOG_DOMAIN) == NULL) { debug_env_new = g_strdup_printf("%s %s", debug_env, G_LOG_DOMAIN); g_setenv("G_MESSAGES_DEBUG", debug_env_new, TRUE); g_free(debug_env_new); } } #else if (!debug_mode) { g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, dummy_log_handler, NULL); } #endif /* GLIB_CHECK_VERSION (2,32,0) */ } xwrited-2/xwrited-utmp-utempter.c000064400017500000144000000026721232724642000175320ustar00gberusers00000000000000/* * Copyright (C) 2010 Guido Berhoerster * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define _XOPEN_SOURCE 600 #include #include void xwrited_utmp_add_entry(int fd) { char *pty_name; pty_name = ptsname(fd); addToUtmp(pty_name, NULL, fd); } void xwrited_utmp_remove_entry(int fd) { char *pty_name; pty_name = ptsname(fd); removeLineFromUtmp(pty_name, fd); } xwrited-2/xwrited-unique.h000064400017500000144000000045041235277643000162200ustar00gberusers00000000000000/* * Copyright (C) 2011 Guido Berhoerster * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XWRITED_UNIQUE_H #define XWRITED_UNIQUE_H #include #include G_BEGIN_DECLS #define XWRITED_TYPE_UNIQUE (xwrited_unique_get_type()) #define XWRITED_UNIQUE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ XWRITED_TYPE_UNIQUE, XWritedUnique)) #define XWRITED_IS_UNIQUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ XWRITED_TYPE_UNIQUE)) #define XWRITED_UNIQUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ XWRITED_TYPE_UNIQUE, XWritedUniqueClass)) #define XWRITED_IS_UNIQUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), \ XWRITED_TYPE_UNIQUE)) #define XWRITED_UNIQUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \ XWRITED_TYPE_UNIQUE, XWritedUniqueClass)) typedef struct _XWritedUnique XWritedUnique; typedef struct _XWritedUniqueClass XWritedUniqueClass; typedef struct _XWritedUniquePrivate XWritedUniquePrivate; struct _XWritedUnique { GObject parent_instance; XWritedUniquePrivate *priv; }; struct _XWritedUniqueClass { GObjectClass parent_class; }; GType xwrited_unique_get_type(void) G_GNUC_CONST; gboolean xwrited_unique_is_unique(XWritedUnique *); XWritedUnique * xwrited_unique_new(const gchar *); G_END_DECLS #endif /* XWRITED_UNIQUE_H */ xwrited-2/README000064400017500000144000000110371245377723500137420ustar00gberusers00000000000000xwrited ======= The xwrited utility displays write(1) and wall(1) messages as desktop notifications. A notification daemon compliant to the freedesktop.org Desktop Notification Specification draft needs to be running in order to display the notifications. Build Instructions ------------------ xwrited requires a POSIX:2004 compatible operating system, it has been tested to work on Linux distributions, FreeBSD, NetBSD, and Solaris and Illumos-derived distributions. The following tools and shared libraries are required to build xwrited: - GNU make >= 3.81 - GNU or BSD install - GLib version 2.26 or later - the D-Bus GLib bindings for GLib < 2.25.5 - libutempter on Linux and FreeBSD < 9.0 Rebuilding the man pages additionally requires the xsltproc tool from libxml2. Before building xwrited check the commented macros in the Makefile for any macros you may need to override depending on the used toolchain and operating system. By default, all files will be installed under the "/usr/local" directory, a different installation path prefix can be set via the `prefix` macro. In addition, a second path prefix can be specified via the `DESTDIR` macro which will be prepended to any path, incuding the `prefix` macro path prefix. In contrast to `prefix`, the path specified via the `DESTDIR` macro will only be prepended to paths during installation and not be used for constructing internal paths. The following instructions assume that `make` is GNU make, on some platforms it may be installed under a different name or a non-default path. In order to start the build process run `make all`. After a successful build, run `make install` to install the program, any associated data files and the documentation. Previously built binaries, object files, generated data files and documentation can be removed by running `make clean`, any additional, generated files which are not removed by the `clean` target can be removed by running `make clobber`. Contact ------- Please send any feedback, translations or bug reports via email to . Bug Reports ----------- When sending bug reports, please always mention the exact version of xwrited with which the issue occurs as well as the version of the operating system you are using and make sure that you provide sufficient information to reproduce the issue and include any input, output, any error messages. In case of build issues, please also specify the implementations and versions of the tools and shared libraries used to build the program, in particular the compiler. In case of crashes, please generate a stack trace with a suitable debugger such as gdb, lldb, dbx, or debug after a crash has occurred either by examining the resulting core file or by running the program from the debugger and attach it to the bug report. In order to generate a meaningful stack trace the program as well as any dynamically linked libraries need to be built with debugging information, see the documentation of the used compiler for the required compiler flags. If any of the dynamically linked shared libraries do not contain debugging information, please either install debugging information for these libraries using mechanisms provided by your operating system or rebuild the libraries accordingly. Please refer to the documentation of the debugger for detailed instructions on generating backtraces. License ------- Except otherwise noted, all files are Copyright (C) 2014 Guido Berhoerster and distributed under the following license terms: Copyright (C) 2014 Guido Berhoerster Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. xwrited-2/xwrited-utmp-utmpx.c000064400017500000144000000050151232724642000170340ustar00gberusers00000000000000/* * Copyright (C) 2010 Guido Berhoerster * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define _XOPEN_SOURCE 600 #include #include #include #include #include #include #include #include #define DEV_PREFIX "/dev/" static void utmp_write_entry(int fd, gboolean add) { struct utmpx utmpx; char *line = NULL; size_t line_len; char *id; struct passwd *pwd; line = ptsname(fd); if (line == NULL) { g_critical("failed to obtain slave pty name"); return; } if (g_str_has_prefix(line, DEV_PREFIX)) { line += strlen(DEV_PREFIX); } line_len = strlen(line); id = (line_len >= sizeof (utmpx.ut_pid)) ? line + (line_len - sizeof (utmpx.ut_pid)) : line; pwd = getpwuid(getuid()); if (pwd == NULL) { g_critical("failed to get username: %s", g_strerror(errno)); return; } memset(&utmpx, 0, sizeof (utmpx)); strncpy(utmpx.ut_name, pwd->pw_name, sizeof (utmpx.ut_name)); strncpy(utmpx.ut_id, id, sizeof (utmpx.ut_id)); strncpy(utmpx.ut_line, line, sizeof (utmpx.ut_line)); utmpx.ut_pid = getpid(); utmpx.ut_type = add ? USER_PROCESS : DEAD_PROCESS; gettimeofday(&utmpx.ut_tv, NULL); setutxent(); if (pututxline(&utmpx) == NULL) { g_critical("failed to write to utmpx database: %s", g_strerror(errno)); return; } endutxent(); } void xwrited_utmp_add_entry(int fd) { utmp_write_entry(fd, TRUE); } void xwrited_utmp_remove_entry(int fd) { utmp_write_entry(fd, FALSE); } xwrited-2/deps.sed000064400017500000144000000012451232724642000144750ustar00gberusers00000000000000/^[^:]\{1,\}:.*\\$/{ h s/\([^:]\{1,\}:\).*/\1/ x s/[^:]\{1,\}:// } /\\$/,/^$/bgen /\\$/,/[^\\]$/{ :gen s/[[:blank:]]*\\$// s/^[[:blank:]]*// G s/\(.*\)\n\(.*\)/\2 \1/ } /^[^:]\{1,\}:[[:blank:]]*$/d /^[^:]\{1,\}\.o:/{ s/[[:blank:]]*[^[:blank:]]\{1,\}\.[cC][[:blank:]]*/ /g s/[[:blank:]]*[^[:blank:]]\{1,\}\.[cC]$//g s/[[:blank:]]*[^[:blank:]]\{1,\}\.cc[[:blank:]]*/ /g s/[[:blank:]]*[^[:blank:]]\{1,\}\.cc$//g s/[[:blank:]]*[^[:blank:]]\{1,\}\.cpp[[:blank:]]*/ /g s/[[:blank:]]*[^[:blank:]]\{1,\}\.cpp$//g /^[^:]\{1,\}:[[:blank:]]*$/d s/^\([^:]\{1,\}\)\.o[[:blank:]]*:[[:blank:]]*\(.*\)/\1.d: $(wildcard \2)\ &/ } xwrited-2/NEWS000064400017500000144000000011131250166032000135270ustar00gberusers00000000000000News ==== xwrited 2 (2015-03-17T00:00:41+01:00) ------------------------------------- - Try to prevent messages from being chopped up into multiple notifications - Do not print a warning if an empty notification is skipped - Display error messages and free errors - Improve README file - Add NEWS file xwrited 1 (2014-06-26T13:00:26+02:00) ------------------------------------- - Add missing prototype - Add Indonesian translation - Add manpage - Add README file - Support FreeBSD > 9.0 - Make use of GDBus for glib >= 2.25.5 - Add support for newer glib versions - Initial revision xwrited-2/xwrited-unique.c000064400017500000144000000176501232727124600162160ustar00gberusers00000000000000/* * Copyright (C) 2014 Guido Berhoerster * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define _XOPEN_SOURCE 600 #include #ifdef HAVE_GLIB_GDBUS #include #else #include #endif /* HAVE_GLIB_GDBUS */ #include #include "xwrited-unique.h" G_DEFINE_TYPE(XWritedUnique, xwrited_unique, G_TYPE_OBJECT) #define XWRITED_UNIQUE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \ XWRITED_TYPE_UNIQUE, XWritedUniquePrivate)) struct _XWritedUniquePrivate { #ifdef HAVE_GLIB_GDBUS GDBusProxy *session_bus_proxy; #else DBusGConnection *session_bus; DBusGProxy *session_bus_proxy; #endif /* HAVE_GLIB_GDBUS */ gchar *name; gboolean is_unique; }; enum { PROP_0, PROP_NAME, PROP_IS_XWRITED_UNIQUE }; static gboolean request_name(XWritedUnique *self) { guint32 request_name_response; GError *error = NULL; #ifdef HAVE_GLIB_GDBUS GVariant *result; g_return_val_if_fail(self->priv->session_bus_proxy != NULL, FALSE); result = g_dbus_proxy_call_sync(self->priv->session_bus_proxy, "RequestName", g_variant_new("(su)", self->priv->name, DBUS_NAME_FLAG_DO_NOT_QUEUE), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); if (result == NULL) { g_warning("failed to acquire service name \"%s\": %s", self->priv->name, error->message); g_error_free(error); return (FALSE); } g_variant_get(result, "(u)", &request_name_response); g_variant_unref(result); #else g_return_val_if_fail(self->priv->session_bus != NULL, FALSE); g_return_val_if_fail(self->priv->session_bus_proxy != NULL, FALSE); if (dbus_g_proxy_call(self->priv->session_bus_proxy, "RequestName", &error, G_TYPE_STRING, self->priv->name, G_TYPE_UINT, DBUS_NAME_FLAG_DO_NOT_QUEUE, G_TYPE_INVALID, G_TYPE_UINT, &request_name_response, G_TYPE_INVALID) == 0) { g_warning("failed to acquire service name \"%s\": %s", self->priv->name, error->message); g_error_free(error); return (FALSE); } #endif /* HAVE_GLIB_GDBUS */ switch (request_name_response) { case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER: return (TRUE); case DBUS_REQUEST_NAME_REPLY_EXISTS: break; default: g_warning("failed to acquire service name \"%s\"", self->priv->name); } return (FALSE); } static void xwrited_unique_get_property(GObject *gobject, guint property_id, GValue *value, GParamSpec *pspec) { XWritedUnique *app = XWRITED_UNIQUE(gobject); switch (property_id) { case PROP_NAME: g_value_set_string(value, app->priv->name); break; case PROP_IS_XWRITED_UNIQUE: g_value_set_boolean(value, app->priv->is_unique); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, property_id, pspec); } } static void xwrited_unique_set_property(GObject *gobject, guint property_id, const GValue *value, GParamSpec *pspec) { XWritedUnique *app = XWRITED_UNIQUE(gobject); switch (property_id) { case PROP_NAME: app->priv->name = g_strdup(g_value_get_string(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, property_id, pspec); } } static GObject * xwrited_unique_constructor(GType gtype, guint n_params, GObjectConstructParam *params) { GObjectClass *parent_class; GObject *gobject; XWritedUnique *app; GError *error = NULL; parent_class = G_OBJECT_CLASS(xwrited_unique_parent_class); gobject = parent_class->constructor(gtype, n_params, params); app = XWRITED_UNIQUE(gobject); #ifdef HAVE_GLIB_GDBUS app->priv->session_bus_proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, NULL, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, NULL, &error); if (app->priv->session_bus_proxy == NULL) { g_warning("failed to create DBus proxy: %s", error->message); g_error_free(error); goto out; } #else app->priv->session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); if (app->priv->session_bus == NULL) { g_warning("failed to connect to DBus session bus: %s", error->message); g_error_free(error); goto out; } app->priv->session_bus_proxy = dbus_g_proxy_new_for_name(app->priv->session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); if (app->priv->session_bus_proxy == NULL) { g_warning("failed to create DBus proxy"); goto out; } #endif /* HAVE_GLIB_GDBUS */ if (request_name(app)) { app->priv->is_unique = TRUE; } out: return (gobject); } static void xwrited_unique_dispose(GObject *gobject) { XWritedUnique *self = XWRITED_UNIQUE(gobject); if (self->priv->session_bus_proxy != NULL) { g_object_unref(self->priv->session_bus_proxy); self->priv->session_bus_proxy = NULL; } #ifndef HAVE_GLIB_GDBUS if (self->priv->session_bus != NULL) { dbus_g_connection_unref(self->priv->session_bus); self->priv->session_bus = NULL; } #endif /* !HAVE_GLIB_GDBUS */ G_OBJECT_CLASS(xwrited_unique_parent_class)->dispose(gobject); } static void xwrited_unique_finalize(GObject *gobject) { XWritedUnique *self = XWRITED_UNIQUE(gobject); g_free(self->priv->name); G_OBJECT_CLASS(xwrited_unique_parent_class)->finalize(gobject); } static void xwrited_unique_class_init(XWritedUniqueClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS(klass); GParamSpec *pspec; gobject_class->constructor = xwrited_unique_constructor; gobject_class->get_property = xwrited_unique_get_property; gobject_class->set_property = xwrited_unique_set_property; gobject_class->dispose = xwrited_unique_dispose; gobject_class->finalize = xwrited_unique_finalize; pspec = g_param_spec_string("name", "Name", "The unique name of the application", NULL, G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB); g_object_class_install_property(gobject_class, PROP_NAME, pspec); pspec = g_param_spec_boolean("is-unique", "Is unique", "Whether the current application instance is unique", FALSE, G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB); g_object_class_install_property(gobject_class, PROP_IS_XWRITED_UNIQUE, pspec); g_type_class_add_private(klass, sizeof (XWritedUniquePrivate)); } static void xwrited_unique_init(XWritedUnique *self) { self->priv = XWRITED_UNIQUE_GET_PRIVATE(self); self->priv->is_unique = FALSE; #ifndef HAVE_GLIB_GDBUS self->priv->session_bus = NULL; #endif /* !HAVE_GLIB_GDBUS */ self->priv->session_bus_proxy = NULL; } XWritedUnique * xwrited_unique_new(const gchar *name) { XWritedUnique *app; g_return_val_if_fail(name != NULL, NULL); app = g_object_new(XWRITED_TYPE_UNIQUE, "name", name, NULL); if ( #ifndef HAVE_GLIB_GDBUS app->priv->session_bus == NULL || #endif /* !HAVE_GLIB_GDBUS */ app->priv->session_bus_proxy == NULL) { g_object_unref(app); return (NULL); } return (app); } gboolean xwrited_unique_is_unique(XWritedUnique *self) { g_return_val_if_fail(XWRITED_IS_UNIQUE(self), FALSE); return (self->priv->is_unique); } xwrited-2/Makefile000064400017500000144000000125211250166033300145010ustar00gberusers00000000000000# # Copyright (C) 2011 Guido Berhoerster # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # PACKAGE = xwrited APP_NAME = org.guido-berhoerster.code.xwrited VERSION = 2 DISTNAME := $(PACKAGE)-$(VERSION) # gcc, clang, icc MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(CPPFLAGS) # Sun/Solaris Studio #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(CPPFLAGS) # X makedepend #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(CPPFLAGS) -- INSTALL := install INSTALL.exec := $(INSTALL) -D -m 0755 INSTALL.data := $(INSTALL) -D -m 0644 PAX := pax GZIP := gzip SED := sed PASTE := paste MSGFMT := msgfmt INTLTOOL_UPDATE := intltool-update INTLTOOL_MERGE := intltool-merge XSLTPROC := xsltproc DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl define generate-manpage-rule = %.$(1): %.$(1).xml $$(XSLTPROC) \ --xinclude \ --stringparam package $$(PACKAGE) \ --stringparam version $$(VERSION)\ data/docbook-update-source-data.xsl $$< | \ $$(XSLTPROC) \ --xinclude \ $$(DOCBOOK5_MANPAGES_FLAGS) \ --output $$@ \ $$(DOCBOOK5_MANPAGES_STYLESHEET) \ - endef DESTDIR ?= prefix ?= /usr/local bindir ?= $(prefix)/bin datadir ?= $(prefix)/share mandir ?= $(datadir)/man localedir ?= $(datadir)/locale sysconfdir ?= /etc xdgautostartdir ?= $(sysconfdir)/xdg/autostart OS_NAME := $(shell uname -s) OS_RELEASE := $(shell uname -r) is_in = $(if $(filter $2, $1),true,false) PKGCONFIG_LIBS := dbus-1 glib-2.0 libnotify EXTRA_LIBS := ifeq ($(OS_NAME),Linux) OBJS_UTMP := xwrited-utmp-utempter.o EXTRA_LIBS += -lutempter else ifeq ($(OS_NAME),FreeBSD) OBJS_UTMP := xwrited-utmp-utempter.o FREEBSD_RELEASE_MAJOR := $(firstword $(subst ., ,$(OS_RELEASE))) # FreeBSD < 9.0 needs libutempter ifeq ($(call is_in, $(OS_RELEASE_MAJOR), 7 8), true) EXTRA_LIBS += -lutempter else EXTRA_LIBS += -lulog endif else OBJS_UTMP := xwrited-utmp-utmpx.o endif ifeq ($(shell pkg-config --exists 'glib-2.0 >= 2.25.5' && printf "true"), true) CPPFLAGS_EXTRA := -DHAVE_GLIB_GDBUS else PKGCONFIG_LIBS += dbus-glib-1 endif OBJS = main.o xwrited-debug.o xwrited-unique.o $(OBJS_UTMP) MANPAGES = data/$(PACKAGE).1 AUTOSTART_FILE = data/$(PACKAGE).desktop MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po)) POTFILE = po/$(PACKAGE).pot POSRCS := $(shell $(SED) -e 's/\#.*//' -e '/^[ \t]*$$/d' \ -e 's/^\[[^]]*\]//' po/POTFILES.in | $(PASTE) -s -d ' ') CPPFLAGS := $(CPPFLAGS_EXTRA) \ $(CPPFLAGS_LIBUTEMPTER) \ $(shell pkg-config --cflags $(PKGCONFIG_LIBS)) \ -DPACKAGE="\"$(PACKAGE)\"" \ -DAPP_NAME=\"$(APP_NAME)\" \ -DVERSION=\"$(VERSION)\" \ -DLOCALEDIR="\"$(localedir)\"" \ -DG_LOG_DOMAIN=\"$(PACKAGE)\" LDLIBS := $(EXTRA_LIBS) \ $(shell pkg-config --libs $(PKGCONFIG_LIBS)) DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \ --stringparam man.copyright.section.enabled 0 .DEFAULT_TARGET = all .PHONY: all clean clobber dist install all: $(PACKAGE) $(MANPAGES) $(MOFILES) $(AUTOSTART_FILE) $(PACKAGE): $(OBJS) $(LINK.o) $^ $(LDLIBS) -o $@ $(POTFILE): po/POTFILES.in $(POSRCS) cd po/ && $(INTLTOOL_UPDATE) --pot --gettext-package="$(PACKAGE)" pot: $(POTFILE) update-po: $(POTFILE) cd po/ && for lang in $(patsubst po/%.mo,%,$(MOFILES)); do \ $(INTLTOOL_UPDATE) --dist --gettext-package="$(PACKAGE)" \ $${lang}; \ done %.o: %.c $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d $(COMPILE.c) -o $@ $< $(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section)))) %.desktop: %.desktop.in $(MOFILES) $(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@ %.mo: %.po $(MSGFMT) -o $@ $< install: $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)" for lang in $(patsubst po/%.mo,%,$(MOFILES)); do \ $(INSTALL.data) po/$${lang}.mo \ "$(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/$(PACKAGE).mo"; \ done $(INSTALL.data) $(AUTOSTART_FILE) \ "$(DESTDIR)$(xdgautostartdir)/$(notdir $(AUTOSTART_FILE))" $(INSTALL.data) data/$(PACKAGE).1 \ "$(DESTDIR)$(mandir)/man1/$(PACKAGE).1" clean: rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(MANPAGES) $(AUTOSTART_FILE) clobber: clean rm -f $(patsubst %.o,%.d,$(OBJS)) dist: clobber $(PAX) -w -x ustar -s ',.*/\..*,,' -s ',./[^/]*\.tar\.gz,,' \ -s ',\./,$(DISTNAME)/,' . | $(GZIP) > $(DISTNAME).tar.gz -include $(patsubst %.o,%.d,$(OBJS)) xwrited-2/po000075500017500000144000000000001243260316200133775ustar00gberusers00000000000000xwrited-2/po/de.po000064400017500000144000000025341232727124600144210ustar00gberusers00000000000000# German translations for xwrited package # German messages for xwrited. # Copyright (C) 2011 Guido Berhoerster. # This file is distributed under the same license as the xwrited package. # Guido Berhoerster , 2011. # msgid "" msgstr "" "Project-Id-Version: xwrited 1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2011-05-20 16:48+0200\n" "PO-Revision-Date: 2010-07-28 13:00+0200\n" "Last-Translator: Guido Berhoerster \n" "Language-Team: German\n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../data/xwrited.desktop.in.h:1 msgid "xwrited" msgstr "xwrited" #: ../data/xwrited.desktop.in.h:2 msgid "Display write and wall messages as desktop notifications" msgstr "Zeigt write und wall Nachrichten as Desktop-Benachrichtigungen an" #. show notification #: ../main.c:179 msgid "Message received" msgstr "Nachricht erhalten" #: ../main.c:280 msgid "Show extra debugging information" msgstr "Zusätzliche Debugging-Informationen anzeigen" #: ../main.c:282 msgid "Print the current version and exit" msgstr "Aktuelle Version zeigen und beenden" #: ../main.c:321 #, c-format msgid "xwrited is already running in this session.\n" msgstr "xwrited läuft bereits in dieser Sitzung.\n" xwrited-2/po/id.po000064400017500000144000000023751232727124600144300ustar00gberusers00000000000000# Indonesian translations for xwrited package. # Copyright (C) 2014 Guido Berhoerster # This file is distributed under the same license as the xwrited package. # Guido Berhoerster , 2014. # msgid "" msgstr "" "Project-Id-Version: xwrited 1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-04-27 23:04+0200\n" "PO-Revision-Date: 2014-04-27 21:01+0200\n" "Last-Translator: Guido Berhoerster \n" "Language-Team: Indonesian\n" "Language: id\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ASCII\n" "Content-Transfer-Encoding: 8bit\n" #: ../data/xwrited.desktop.in.h:1 msgid "xwrited" msgstr "xwrited" #: ../data/xwrited.desktop.in.h:2 msgid "Display write and wall messages as desktop notifications" msgstr "Tampilkan pesanan write dan wall sebagai notifikasi desktop" #. show notification #: ../main.c:179 msgid "Message received" msgstr "Pesanan diterima" #: ../main.c:280 msgid "Show extra debugging information" msgstr "Tampilkan informasi debug tambahan" #: ../main.c:282 msgid "Print the current version and exit" msgstr "Tampilkan versi kini dan keluar" #: ../main.c:321 #, c-format msgid "xwrited is already running in this session.\n" msgstr "xwrited sudah berjalan pada sesi ini.\n" xwrited-2/po/POTFILES.in000064400017500000144000000001551232727124600152430ustar00gberusers00000000000000data/xwrited.desktop.in main.c xwrited-debug.c xwrited-unique.c xwrited-utmp-utempter.c xwrited-utmp-utmpx.c