summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Wieninger <cwieninger (at) gmx (dot) de>2009-03-23 19:23:58 +0100
committerChristian Wieninger <cwieninger (at) gmx (dot) de>2009-03-23 19:23:58 +0100
commitb7d2d7581f5a287ae8104ae06ece2129c0aadbc5 (patch)
tree1f9141ac8f25eca66a25eaf880cd76ef49164074
parentfd47a9dce6ae3e04776b8d76d68e4c43a9a08320 (diff)
downloadvdr-plugin-epgsearch-b7d2d7581f5a287ae8104ae06ece2129c0aadbc5.tar.gz
vdr-plugin-epgsearch-b7d2d7581f5a287ae8104ae06ece2129c0aadbc5.tar.bz2
autoconfig and autodetecting mail encoding
-rw-r--r--HISTORY3
-rw-r--r--HISTORY.DE4
-rw-r--r--Makefile77
-rw-r--r--epgsearch.c24
-rw-r--r--epgsearchtools.c27
-rw-r--r--epgsearchtools.h1
-rw-r--r--mail.c25
7 files changed, 119 insertions, 42 deletions
diff --git a/HISTORY b/HISTORY
index b4f862c..0f27ee7 100644
--- a/HISTORY
+++ b/HISTORY
@@ -38,6 +38,9 @@ new:
my case its the most common entry to change, e.g. to select a folder for the recording.
- auto enable Wareagle icons if VDRSymbols font is used (can be overwritten with
WarEagleIcons=0 in epgsearchmenu.conf), suggested by Ronny Kornexl
+- the correct content encoding for mail notifications is now automatically detected
+- epgsearch now autodetects an installed pin plugin or graphtft, also the optional libraries
+ libpcre und libtre (can be turned off by commenting AUTOCONFIG in the Makefile)
fixes:
- fixed a crash when pressing 'Ok' in an empty timers done menu
- fixed a crash when using the progressbar and events with 0 duration exist, thanks
diff --git a/HISTORY.DE b/HISTORY.DE
index 0f63fbf..4c1fb13 100644
--- a/HISTORY.DE
+++ b/HISTORY.DE
@@ -42,6 +42,10 @@ neu:
- Wareagle Icons werden bei Verwendung des VDRSymbols-Font nun automatisch aktiv (kann aber
mit WarEagleIcons=0 in epgsearchmenu.conf überschrieben werden), vorgeschlagen von
Ronny Kornexl
+- Das korrekte Encoding für Email-Benachrichtigungen wird nun automatisch erkannt.
+- Es wird nun automatisch erkannt, ob Pin-Plugin oder Graphtft installiert sind, ebenso die
+ optionalen Libs libpcre und libtre (läßt sich im Makefile mit Kommentieren von AUTOCONFIG
+ abschalten)
fixes:
- Absturz beim Drücken von 'Ok' in leerem Menü erledigter Timer behoben
- Absturz bei Verwendung des Fortschrittsbalkens in Verbindung mit Sendungen
diff --git a/Makefile b/Makefile
index e21b81a..9aa1e8c 100644
--- a/Makefile
+++ b/Makefile
@@ -4,25 +4,55 @@
# Christian Wieninger cwieninger at gmx.de
#
-### uncomment one of these lines, if you don't want the addon epgsearchonly, conflictcheckonly
+### ------------
+### CONFIG START
+###
+### to comment an option just place a '#' at the beginning of the line
+### to uncomment an option please remove the leading '#'
+
+### uncomment one of these lines, if you don't want the addon epgsearchonly,
+### conflictcheckonly or quickepgsearch
+
#WITHOUT_EPGSEARCHONLY=1
#WITHOUT_CONFLICTCHECKONLY=1
#WITHOUT_QUICKSEARCH=1
-PLUGIN = epgsearch
-MAINMENUSHORTCUT = epgsearchmainmenushortcut
-PLUGIN2 = epgsearchonly
-PLUGIN3 = conflictcheckonly
-PLUGIN4 = quickepgsearch
+### comment this if you don't want epgsearch to auto config itself
+AUTOCONFIG=1
+### if AUTOCONFIG is not active (i.e. commented) you can manually enable the
+### optional modules or patches for other plugins
+ifndef AUTOCONFIG
# uncomment this if you want to use Perl compatible regular expressions (PCRE),
# also have a look at INSTALL for further notes on this
+
#HAVE_PCREPOSIX=1
# uncomment this if you want to use libtre for unlimited fuzzy searching,
# also have a look at INSTALL for further notes on this
+
#HAVE_LIBTRE=1
+# uncomment this to enable support for the pin plugin.
+
+#USE_PINPLUGIN = 1
+
+# uncomment this to enable support for the graphtft plugin.
+#USE_GRAPHTFT = 1
+
+endif
+
+###
+### CONFIG END
+### do not edit below this line if you don't know what you do ;-)
+### -------------------------------------------------------------
+
+PLUGIN = epgsearch
+MAINMENUSHORTCUT = epgsearchmainmenushortcut
+PLUGIN2 = epgsearchonly
+PLUGIN3 = conflictcheckonly
+PLUGIN4 = quickepgsearch
+
### The version number of this plugin (taken from the main source file):
VERSION = $(shell grep 'static const char VERSION\[\] *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
@@ -39,6 +69,22 @@ VDRDIR = ../../..
LIBDIR = ../../lib
TMPDIR = /tmp
+### auto configuring modules
+ifdef AUTOCONFIG
+ ifeq (exists, $(shell pkg-config libpcre && echo exists))
+ HAVE_PCREPOSIX = 1
+ endif
+ ifeq (exists, $(shell pkg-config tre && echo exists))
+ HAVE_LIBTRE = 1
+ endif
+ ifeq (exists, $(shell test -e ../pin && echo exists))
+ USE_PINPLUGIN = 1
+ endif
+ ifeq (exists, $(shell test -e ../graphtft && echo exists))
+ USE_GRAPHTFT = 1
+ endif
+endif
+
### Allow user defined options to overwrite defaults:
-include $(VDRDIR)/Make.config
@@ -83,14 +129,25 @@ DEFINES4 += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN4)"'
OBJS = afuzzy.o blacklist.o changrp.o confdloader.o conflictcheck.o conflictcheck_thread.o distance.o $(PLUGIN).o epgsearchcats.o epgsearchcfg.o epgsearchext.o epgsearchsetup.o epgsearchsvdrp.o epgsearchtools.o i18n.o mail.o md5.o menu_announcelist.o menu_blacklistedit.o menu_blacklists.o menu_commands.o menu_conflictcheck.o menu_deftimercheckmethod.o menu_dirselect.o menu_event.o menu_favorites.o menu_main.o menu_myedittimer.o menu_quicksearch.o menu_recsdone.o menu_search.o menu_searchactions.o menu_searchedit.o menu_searchresults.o menu_searchtemplate.o menu_switchtimers.o menu_templateedit.o menu_timersdone.o menu_whatson.o noannounce.o rcfile.o recdone.o recstatus.o searchtimer_thread.o services.o switchtimer.o switchtimer_thread.o templatefile.o timer_thread.o timerdone.o timerstatus.o uservars.o varparser.o
ifdef HAVE_PCREPOSIX
-LIBS += -L/usr/lib -lpcreposix -lpcre
+LIBS += $(shell pcre-config --libs-posix)
+#LIBS += -L/usr/lib -lpcreposix -lpcre
+INCLUDE += $(shell pcre-config --cflags)
DEFINES += -DHAVE_PCREPOSIX
endif
-#ifdef HAVE_LIBTRE
+ifdef HAVE_LIBTRE
+LIBS += -L$(shell pkg-config --variable=libdir tre) $(shell pkg-config --libs tre)
#LIBS += -L/usr/lib -ltre
-#DEFINES += -DHAVE_LIBTRE
-#endif
+DEFINES += -DHAVE_LIBTRE
+endif
+
+ifdef USE_PINPLUGIN
+DEFINES += -DUSE_PINPLUGIN
+endif
+
+ifdef USE_GRAPHTFT
+DEFINES += -DUSE_GRAPHTFT
+endif
ifdef CFLC
DEFINES += -DCFLC
diff --git a/epgsearch.c b/epgsearch.c
index 12a4e43..9258a92 100644
--- a/epgsearch.c
+++ b/epgsearch.c
@@ -65,11 +65,8 @@ The project's page is at http://winni.vdr-developer.org/epgsearch
#include "menu_quicksearch.h"
#include "menu_announcelist.h"
#include "confdloader.h"
-#if APIVERSNUM >= 10503
-#include <langinfo.h>
-#endif
-static const char VERSION[] = "0.9.25.beta11";
+static const char VERSION[] = "0.9.25.beta12";
static const char DESCRIPTION[] = trNOOP("search the EPG for repeats and more");
// globals
@@ -467,23 +464,8 @@ bool cPluginEpgsearch::Start(void)
void cPluginEpgsearch::CheckUTF8()
{
-#if APIVERSNUM >= 10503
- // Taken from VDR's vdr.c
- char *CodeSet = NULL;
- if (setlocale(LC_CTYPE, ""))
- CodeSet = nl_langinfo(CODESET);
- else {
- char *LangEnv = getenv("LANG"); // last resort in case locale stuff isn't installed
- if (LangEnv) {
- CodeSet = strchr(LangEnv, '.');
- if (CodeSet)
- CodeSet++; // skip the dot
- }
- }
-
- if (CodeSet && strcasestr(CodeSet, "UTF-8") != 0)
- isUTF8=true;
-#endif
+ std::string CodeSet = GetCodeset();
+ isUTF8 = EqualsNoCase(CodeSet, "UTF-8");
}
void cPluginEpgsearch::Stop(void)
diff --git a/epgsearchtools.c b/epgsearchtools.c
index 068aa39..8021c12 100644
--- a/epgsearchtools.c
+++ b/epgsearchtools.c
@@ -38,6 +38,9 @@ The project's page is at http://winni.vdr-developer.org/epgsearch
#include "afuzzy.h"
#include "i18n.h"
#include "timerstatus.h"
+#if APIVERSNUM >= 10503
+#include <langinfo.h>
+#endif
#ifdef HAVE_PCREPOSIX
#include <pcreposix.h>
@@ -1030,3 +1033,27 @@ int msprintf(char **strp, const char *fmt, ...)
va_end (ap);
return res;
}
+
+std::string GetCodeset()
+{
+#if APIVERSNUM >= 10503
+ // Taken from VDR's vdr.c
+ char *CodeSet = NULL;
+ if (setlocale(LC_CTYPE, ""))
+ CodeSet = nl_langinfo(CODESET);
+ else {
+ char *LangEnv = getenv("LANG"); // last resort in case locale stuff isn't installed
+ if (LangEnv) {
+ CodeSet = strchr(LangEnv, '.');
+ if (CodeSet)
+ CodeSet++; // skip the dot
+ }
+ }
+ if (CodeSet)
+ return std::string(CodeSet);
+ else
+ return "ISO-8859-15";
+#else
+ return "ISO-8859-15";
+#endif
+}
diff --git a/epgsearchtools.h b/epgsearchtools.h
index 7451b0d..b21b386 100644
--- a/epgsearchtools.h
+++ b/epgsearchtools.h
@@ -171,6 +171,7 @@ string MD5(const string& input);
time_t GetDateTime(time_t day, int start);
void SetAux(cTimer* timer, string aux);
int msprintf(char **strp, const char *fmt, ...);
+std::string GetCodeset();
// --- cTimerObj --------------------------------------------------------
class cTimerObj : public cListObject {
diff --git a/mail.c b/mail.c
index 66527cb..087cab1 100644
--- a/mail.c
+++ b/mail.c
@@ -31,6 +31,7 @@ The project's page is at http://winni.vdr-developer.org/epgsearch
#include "epgsearchtools.h"
#include "uservars.h"
+extern bool isUTF8;
using namespace std;
string cMailNotifier::MailCmd = "sendEmail.pl";
@@ -143,9 +144,9 @@ bool cMailNotifier::SendMailViaSendmail()
fprintf(mail, "To: %s\n", to.c_str());
fprintf(mail, "Subject: %s\n", subject.c_str());
if (FindIgnoreCase(body, "<html>") >= 0)
- fprintf(mail, "Content-Type: text/html; charset=ISO-8859-15\n");
+ fprintf(mail, "Content-Type: text/html; charset=%s\n", GetCodeset().c_str());
else
- fprintf(mail, "Content-Type: text/plain; charset=ISO-8859-15\n");
+ fprintf(mail, "Content-Type: text/plain; charset=%s\n", GetCodeset().c_str());
fprintf(mail, "\n");
@@ -172,15 +173,16 @@ bool cMailNotifier::SendMailViaScript()
string AuthUser = EPGSearchConfig.MailAuthUser;
string AuthPass = EPGSearchConfig.MailAuthPass;
string cmdArgs =
- string(" -f \"VDR <") + EPGSearchConfig.MailAddress + ">\"" +
- " -t " + EPGSearchConfig.MailAddressTo +
- " -s " + EPGSearchConfig.MailServer +
- " -u \"" + subject + "\""+
- (EPGSearchConfig.MailUseAuth?
- (AuthUser != "" ?(" -xu " + AuthUser):"") +
- (AuthPass != "" ?(" -xp " + AuthPass):"")
- :"") +
- " -o message-file=" + filename;
+ string(" -f \"VDR <") + EPGSearchConfig.MailAddress + ">\"" +
+ " -t " + EPGSearchConfig.MailAddressTo +
+ " -s " + EPGSearchConfig.MailServer +
+ " -u \"" + subject + "\""+
+ (EPGSearchConfig.MailUseAuth?
+ (AuthUser != "" ?(" -xu " + AuthUser):"") +
+ (AuthPass != "" ?(" -xp " + AuthPass):"")
+ :"") +
+ " -o message-charset=" + GetCodeset() +
+ " -o message-file=" + filename;
bool success = ExecuteMailScript(cmdArgs);
@@ -201,6 +203,7 @@ bool cMailNotifier::SendMail()
bool cMailNotifier::ExecuteMailScript(string ScriptArgs)
{
string mailCmd = MailCmd;
+ LogFile.Log(3, "starting mail script: %s with parameters: %s", mailCmd.c_str(), ScriptArgs.c_str());
if (mailCmd == "sendEmail.pl") // beautify output for standard script
ScriptArgs += " | cut -d\" \" -f 6-";