Remove old extsay module
authorMikael Berthe <mikael@lilotux.net>
Sun, 04 Apr 2010 16:00:35 +0200
changeset 34 105fdf20c1c1
parent 33 e9bb68c35bf3
child 35 337add12c399
Remove old extsay module I'll make a separate package for extsay_old.
Makefile.am
configure.ac
extsay-ng/Makefile.am
extsay-old/Makefile.am
extsay-old/extsay_old.c
--- a/Makefile.am	Sat Apr 03 23:21:31 2010 +0200
+++ b/Makefile.am	Sun Apr 04 16:00:35 2010 +0200
@@ -1,1 +1,1 @@
-SUBDIRS = clock comment extsay-ng extsay-old info_msgcount killpresence lastmsg
+SUBDIRS = clock comment extsay-ng info_msgcount killpresence lastmsg
--- a/configure.ac	Sat Apr 03 23:21:31 2010 +0200
+++ b/configure.ac	Sun Apr 04 16:00:35 2010 +0200
@@ -109,10 +109,6 @@
               AC_HELP_STRING([--enable-module-extsayng],
                              [enable module extsayng]),
               enable_module_extsayng=$enableval)
-AC_ARG_ENABLE(module-extsay_old,
-              AC_HELP_STRING([--enable-module-extsay_old],
-                             [enable module extsay_old]),
-              enable_module_extsay_old=$enableval)
 AC_ARG_ENABLE(module-info_msgcount,
               AC_HELP_STRING([--enable-module-info_msgcount],
                              [enable module info_msgcount]),
@@ -138,10 +134,6 @@
                [test x"${enable_all_modules}" = x"yes" -o \
                      x"${enable_module_extsayng}" = x"yes"])
 
-AM_CONDITIONAL([INSTALL_MODULE_EXTSAY_OLD],
-               [test x"${enable_all_modules}" = x"yes" -o \
-                     x"${enable_module_extsay_old}" = x"yes"])
-
 AM_CONDITIONAL([INSTALL_MODULE_INFO_MSGCOUNT],
                [test x"${enable_all_modules}" = x"yes" -o \
                      x"${enable_module_info_msgcount}" = x"yes"])
@@ -157,7 +149,6 @@
 AC_CONFIG_FILES([clock/Makefile
                  comment/Makefile
                  extsay-ng/Makefile
-                 extsay-old/Makefile
                  info_msgcount/Makefile
                  killpresence/Makefile
                  lastmsg/Makefile
--- a/extsay-ng/Makefile.am	Sat Apr 03 23:21:31 2010 +0200
+++ b/extsay-ng/Makefile.am	Sun Apr 04 16:00:35 2010 +0200
@@ -1,9 +1,9 @@
 
 if INSTALL_MODULE_EXTSAYNG
 
-pkglib_LTLIBRARIES = libextsayng.la
-libextsayng_la_SOURCES = extsayng.c
-libextsayng_la_LDFLAGS = -module -avoid-version -shared
+pkglib_LTLIBRARIES = libextsay.la
+libextsay_la_SOURCES = extsay.c
+libextsay_la_LDFLAGS = -module -avoid-version -shared
 
 LDADD = $(GLIB_LIBS) $(MCABBER_LIBS)
 AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(MCABBER_CFLAGS)
--- a/extsay-old/Makefile.am	Sat Apr 03 23:21:31 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-if INSTALL_MODULE_EXTSAY_OLD
-
-pkglib_LTLIBRARIES = libextsay_old.la
-libextsay_old_la_SOURCES = extsay_old.c
-libextsay_old_la_LDFLAGS = -module -avoid-version -shared
-
-LDADD = $(GLIB_LIBS) $(MCABBER_LIBS)
-AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(MCABBER_CFLAGS)
-
-endif
--- a/extsay-old/extsay_old.c	Sat Apr 03 23:21:31 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*
-   Copyright 2009,2010 Andreas Fett
-   Copyright 2010 Mikael Berthe
-
-  Module "extsay_old" -- adds a /extsay_old command
-                         Spawns an external editor
-  Original code from Andreas Fett.
-
-This module is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-#include <glib/gstdio.h>
-
-#include <mcabber/modules.h>
-#include <mcabber/commands.h>
-#include <mcabber/screen.h>
-
-static void extsay_old_init(void);
-static void extsay_old_uninit(void);
-
-/* Module description */
-module_info_t info_extsay_old = {
-        .branch         = MCABBER_BRANCH,
-        .api            = MCABBER_API_VERSION,
-        .version        = "0.01",
-        .description    = "Use external editor to send a message\n"
-                          "WARNING: use at your own risk - "
-                          "mcabber is stuck while you write a message, "
-                          "this is not recommended!",
-        .requires       = NULL,
-        .init           = extsay_old_init,
-        .uninit         = extsay_old_uninit,
-        .next           = NULL,
-};
-
-// XXX Not very clean, internal function...
-char *load_message_from_file(const char *filename);
-
-static char* spawn_editor() {
-  GError *err = NULL;
-  gchar *argv[] = { NULL, NULL };
-  gchar *tmpfile = NULL;
-  gchar *tmpl = "mcabber-XXXXXX";
-  gchar *msg;
-  gboolean ret;
-  gint fd;
-  gint exit_status = 0;
-
-  argv[0] = (gchar*)g_getenv("EDITOR");
-  if (argv[0] == NULL) {
-    scr_LogPrint(LPRINT_NORMAL, "Environment variable EDITOR not set.");
-    return NULL;
-  }
-
-  fd = g_file_open_tmp(tmpl, &tmpfile, &err);
-  if ( fd < 0 ) {
-    scr_LogPrint(LPRINT_NORMAL, err->message);
-    g_error_free(err);
-    return NULL;
-  }
-  close(fd);
-
-  argv[1] = tmpfile;
-
-  endwin();
-  ret = g_spawn_sync(NULL, argv, NULL,
-                     G_SPAWN_CHILD_INHERITS_STDIN|G_SPAWN_SEARCH_PATH,
-                     NULL, NULL, NULL, NULL, &exit_status, &err);
-
-  raw();
-  readline_refresh_screen();
-
-  if (!ret) {
-    scr_LogPrint(LPRINT_NORMAL, err->message);
-    return NULL;
-  }
-
-  if (WEXITSTATUS(exit_status) != EXIT_SUCCESS) {
-    scr_LogPrint(LPRINT_NORMAL,
-                 "Editor exited with error, discarding message.");
-    return NULL;
-  }
-
-  msg = load_message_from_file(tmpfile);
-
-  if (g_unlink(tmpfile) != 0)
-    scr_LogPrint(LPRINT_NORMAL, "Warning, could not remove temp file.");
-
-  return msg;
-}
-
-static void do_extsay_old(char *args)
-{
-  char *msg = spawn_editor();
-  if (msg) {
-    say_cmd(msg, 0);
-    g_free(msg);
-  }
-}
-
-/* Initialization */
-static void extsay_old_init(void)
-{
-  /* Add command */
-  cmd_add("extsay_old", "Use external editor to write a message",
-          0, 0, do_extsay_old, NULL);
-  scr_LogPrint(LPRINT_NORMAL, "Loading module extsay_old...\n"
-               "** Be careful, everything is on hold while you run the "
-               "external editor.\n"
-               "** Do not run it for too long!"
-               );
-}
-
-/* Deinitialization */
-static void extsay_old_uninit(void)
-{
-  /* Unregister command */
-  cmd_del("extsay_old");
-}
-
-/* vim: set expandtab cindent cinoptions=>2\:2(0:  For Vim users... */