Project "Tuxbox-GIT: apps":
The branch, master has been updated
via a06c2c6403315904a2f803ab6417c4c554d072bf (commit)
via e732447ca2f05d66a4f62104f3c2ff2f3b5c3629 (commit)
via 57f9c8b8f10d219e7f8e654939e15f63a194b2a0 (commit)
via 8e0aa4c0b9a0cb55c6b5da795cf2cb66414ab811 (commit)
via 703d44902bdd72a8490aaf90c765997992d87767 (commit)
via 43294adfaa570486a5dd118ffa3d55569e47bcf6 (commit)
via bf71299a4d1a9939273cbd178dc7a2b6c1d9cee2 (commit)
via 11f4071bcc45888c9edad68b3bf0a9e84ea0359d (commit)
via c91f0f579924a2cce9d74f87fadbdf411e2d1aeb (commit)
from d6b9cf22da9ab7ae02fdcf366fee87f396c6015c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a06c2c6403315904a2f803ab6417c4c554d072bf
Author: GetAway <get-a...@t-online.de>
Date: Sun Sep 28 19:37:57 2014 +0200
input: add utf8_to_latin1 encoding version bump 1.40
Signed-off-by: GetAway <get-a...@t-online.de>
Signed-off-by: Thilo Graf <d...@novatux.de>
diff --git a/tuxbox/tools/input/input.c b/tuxbox/tools/input/input.c
index 2e227ce..23d518f 100644
--- a/tuxbox/tools/input/input.c
+++ b/tuxbox/tools/input/input.c
@@ -36,7 +36,7 @@
#define NCF_FILE "/var/tuxbox/config/neutrino.conf"
#define ECF_FILE "/var/tuxbox/config/engima/config"
#define BUFSIZE 1024
-#define I_VERSION 1.39
+#define I_VERSION 1.40
#define FONT "/share/fonts/pakenham.ttf"
diff --git a/tuxbox/tools/input/text.c b/tuxbox/tools/input/text.c
index 5cabd92..cde98c8 100644
--- a/tuxbox/tools/input/text.c
+++ b/tuxbox/tools/input/text.c
@@ -155,8 +155,8 @@ int stringlen = 0;
int RenderString(char *string, int sx, int sy, int maxwidth, int layout, int
size, int color)
{
- int stringlen, ex, charwidth,i,found;
- char rstr[256], *rptr=rstr, rc;
+ int stringlen = 0, ex = 0, charwidth = 0, i = 0, found = 0;
+ char rstr[256]={0}, *rptr=rstr, rc=' ';
int varcolor=color;
//set size
@@ -232,6 +232,50 @@ int RenderString(char *string, int sx, int sy, int
maxwidth, int layout, int siz
}
else
{
+ int uml = 0;
+ switch(*rptr) /* skip Umlauts */
+ {
+ case '\xc4':
+ case '\xd6':
+ case '\xdc':
+ case '\xe4':
+ case '\xf6':
+ case '\xfc':
+ case '\xdf': uml=1; break;
+ }
+ if (uml == 0)
+ {
+ // UTF8_to_Latin1 encoding
+ if (((*rptr) & 0xf0) == 0xf0) /*
skip (can't be encoded in Latin1) */
+ {
+ rptr++;
+ if ((*rptr) == 0)
+ *rptr='\x3f'; // ?
question mark
+ rptr++;
+ if ((*rptr) == 0)
+ *rptr='\x3f';
+ rptr++;
+ if ((*rptr) == 0)
+ *rptr='\x3f';
+ }
+ else if (((*rptr) & 0xe0) == 0xe0) /*
skip (can't be encoded in Latin1) */
+ {
+ rptr++;
+ if ((*rptr) == 0)
+ *rptr='\x3f';
+ rptr++;
+ if ((*rptr) == 0)
+ *rptr='\x3f';
+ }
+ else if (((*rptr) & 0xc0) == 0xc0)
+ {
+ char c = (((*rptr) & 3) << 6);
+ rptr++;
+ if ((*rptr) == 0)
+ *rptr='\x3f';
+ *rptr = (c | ((*rptr) & 0x3f));
+ }
+ }
if((charwidth = RenderChar(*rptr, sx, sy, ex,
varcolor)) == -1) return sx; /* string > maxwidth */
sx += charwidth;
}
commit e732447ca2f05d66a4f62104f3c2ff2f3b5c3629
Author: Christian Schuett <gaucho...@hotmail.com>
Date: Fri Sep 12 23:20:57 2014 +0200
Neutrino: move theme loading to class CThemes
this avoids keeping default theme data multiple times and removes
duplicate code in classes CNeutrinoApp and CThemes
based on patches by martii <m4r...@gmx.de> in Neutrino-MP Git and
[CST] Focus <focus....@gmail.com> in Coolstream Git
Signed-off-by: Christian Schuett <gaucho...@hotmail.com>
Signed-off-by: Thilo Graf <d...@novatux.de>
diff --git a/tuxbox/neutrino/src/gui/themes.cpp
b/tuxbox/neutrino/src/gui/themes.cpp
index 4981d07..000d152 100644
--- a/tuxbox/neutrino/src/gui/themes.cpp
+++ b/tuxbox/neutrino/src/gui/themes.cpp
@@ -46,7 +46,7 @@
#define THEMEDIR THEMESDIR "/"
#define USERDIR "/var" THEMEDIR
-#define FILE_PREFIX ".theme"
+#define FILE_SUFFIX ".theme"
CThemes::CThemes(const neutrino_locale_t title, const char * const IconName)
: themefile('\t')
@@ -84,10 +84,10 @@ int CThemes::exec(CMenuTarget* parent, const std::string &
actionKey)
if ( strstr(themeFile.c_str(), "{U}") != 0 )
{
themeFile.erase(0, 3);
- readFile((char*)((std::string)USERDIR +
themeFile + FILE_PREFIX).c_str());
+ readFile((char*)((std::string)USERDIR +
themeFile + FILE_SUFFIX).c_str());
}
else
- readFile((char*)((std::string)THEMEDIR +
themeFile + FILE_PREFIX).c_str());
+ readFile((char*)((std::string)THEMEDIR +
themeFile + FILE_SUFFIX).c_str());
}
return res;
}
@@ -185,8 +185,8 @@ int CThemes::Show()
int res = themes.exec(NULL, "");
selected = themes.getSelected();
- if (file_name.length() > 1) {
- saveFile((char*)((std::string)USERDIR + file_name +
FILE_PREFIX).c_str());
+ if (file_name.length() > 0) {
+ saveFile((char*)((std::string)USERDIR + file_name +
FILE_SUFFIX).c_str());
}
if (hasThemeChanged) {
@@ -293,47 +293,7 @@ void CThemes::readFile(char* themename)
{
if(themefile.loadConfig(themename))
{
- g_settings.menu_Head_alpha = themefile.getInt32(
"menu_Head_alpha", 0x00 );
- g_settings.menu_Head_red = themefile.getInt32( "menu_Head_red",
0x00 );
- g_settings.menu_Head_green = themefile.getInt32(
"menu_Head_green", 0x0A );
- g_settings.menu_Head_blue = themefile.getInt32(
"menu_Head_blue", 0x19 );
- g_settings.menu_Head_Text_alpha = themefile.getInt32(
"menu_Head_Text_alpha", 0x00 );
- g_settings.menu_Head_Text_red = themefile.getInt32(
"menu_Head_Text_red", 0x5f );
- g_settings.menu_Head_Text_green = themefile.getInt32(
"menu_Head_Text_green", 0x46 );
- g_settings.menu_Head_Text_blue = themefile.getInt32(
"menu_Head_Text_blue", 0x00 );
- g_settings.menu_Content_alpha = themefile.getInt32(
"menu_Content_alpha", 0x14 );
- g_settings.menu_Content_red = themefile.getInt32(
"menu_Content_red", 0x00 );
- g_settings.menu_Content_green = themefile.getInt32(
"menu_Content_green", 0x0f );
- g_settings.menu_Content_blue = themefile.getInt32(
"menu_Content_blue", 0x23 );
- g_settings.menu_Content_Text_alpha = themefile.getInt32(
"menu_Content_Text_alpha", 0x00 );
- g_settings.menu_Content_Text_red = themefile.getInt32(
"menu_Content_Text_red", 0x64 );
- g_settings.menu_Content_Text_green = themefile.getInt32(
"menu_Content_Text_green", 0x64 );
- g_settings.menu_Content_Text_blue = themefile.getInt32(
"menu_Content_Text_blue", 0x64 );
- g_settings.menu_Content_Selected_alpha = themefile.getInt32(
"menu_Content_Selected_alpha", 0x14 );
- g_settings.menu_Content_Selected_red = themefile.getInt32(
"menu_Content_Selected_red", 0x19 );
- g_settings.menu_Content_Selected_green = themefile.getInt32(
"menu_Content_Selected_green", 0x37 );
- g_settings.menu_Content_Selected_blue = themefile.getInt32(
"menu_Content_Selected_blue", 0x64 );
- g_settings.menu_Content_Selected_Text_alpha =
themefile.getInt32( "menu_Content_Selected_Text_alpha", 0x00 );
- g_settings.menu_Content_Selected_Text_red = themefile.getInt32(
"menu_Content_Selected_Text_red", 0x00 );
- g_settings.menu_Content_Selected_Text_green =
themefile.getInt32( "menu_Content_Selected_Text_green", 0x00 );
- g_settings.menu_Content_Selected_Text_blue =
themefile.getInt32( "menu_Content_Selected_Text_blue", 0x00 );
- g_settings.menu_Content_inactive_alpha = themefile.getInt32(
"menu_Content_inactive_alpha", 0x14 );
- g_settings.menu_Content_inactive_red = themefile.getInt32(
"menu_Content_inactive_red", 0x00 );
- g_settings.menu_Content_inactive_green = themefile.getInt32(
"menu_Content_inactive_green", 0x0f );
- g_settings.menu_Content_inactive_blue = themefile.getInt32(
"menu_Content_inactive_blue", 0x23 );
- g_settings.menu_Content_inactive_Text_alpha =
themefile.getInt32( "menu_Content_inactive_Text_alpha", 0x00 );
- g_settings.menu_Content_inactive_Text_red = themefile.getInt32(
"menu_Content_inactive_Text_red", 55 );
- g_settings.menu_Content_inactive_Text_green =
themefile.getInt32( "menu_Content_inactive_Text_green", 70 );
- g_settings.menu_Content_inactive_Text_blue =
themefile.getInt32( "menu_Content_inactive_Text_blue", 85 );
- g_settings.infobar_alpha = themefile.getInt32( "infobar_alpha",
0x14 );
- g_settings.infobar_red = themefile.getInt32( "infobar_red",
0x00 );
- g_settings.infobar_green = themefile.getInt32( "infobar_green",
0x0e );
- g_settings.infobar_blue = themefile.getInt32( "infobar_blue",
0x23 );
- g_settings.infobar_Text_alpha = themefile.getInt32(
"infobar_Text_alpha", 0x00 );
- g_settings.infobar_Text_red = themefile.getInt32(
"infobar_Text_red", 0x64 );
- g_settings.infobar_Text_green = themefile.getInt32(
"infobar_Text_green", 0x64 );
- g_settings.infobar_Text_blue = themefile.getInt32(
"infobar_Text_blue", 0x64 );
-
+ getColors(themefile);
colorSetupNotifier->changeNotify(NONEXISTANT_LOCALE, NULL);
hasThemeChanged = true;
}
@@ -343,105 +303,104 @@ void CThemes::readFile(char* themename)
void CThemes::saveFile(char * themename)
{
- themefile.setInt32( "menu_Head_alpha", g_settings.menu_Head_alpha );
- themefile.setInt32( "menu_Head_red", g_settings.menu_Head_red );
- themefile.setInt32( "menu_Head_green", g_settings.menu_Head_green );
- themefile.setInt32( "menu_Head_blue", g_settings.menu_Head_blue );
- themefile.setInt32( "menu_Head_Text_alpha",
g_settings.menu_Head_Text_alpha );
- themefile.setInt32( "menu_Head_Text_red", g_settings.menu_Head_Text_red
);
- themefile.setInt32( "menu_Head_Text_green",
g_settings.menu_Head_Text_green );
- themefile.setInt32( "menu_Head_Text_blue",
g_settings.menu_Head_Text_blue );
- themefile.setInt32( "menu_Content_alpha", g_settings.menu_Content_alpha
);
- themefile.setInt32( "menu_Content_red", g_settings.menu_Content_red );
- themefile.setInt32( "menu_Content_green", g_settings.menu_Content_green
);
- themefile.setInt32( "menu_Content_blue", g_settings.menu_Content_blue );
- themefile.setInt32( "menu_Content_Text_alpha",
g_settings.menu_Content_Text_alpha );
- themefile.setInt32( "menu_Content_Text_red",
g_settings.menu_Content_Text_red );
- themefile.setInt32( "menu_Content_Text_green",
g_settings.menu_Content_Text_green );
- themefile.setInt32( "menu_Content_Text_blue",
g_settings.menu_Content_Text_blue );
- themefile.setInt32( "menu_Content_Selected_alpha",
g_settings.menu_Content_Selected_alpha );
- themefile.setInt32( "menu_Content_Selected_red",
g_settings.menu_Content_Selected_red );
- themefile.setInt32( "menu_Content_Selected_green",
g_settings.menu_Content_Selected_green );
- themefile.setInt32( "menu_Content_Selected_blue",
g_settings.menu_Content_Selected_blue );
- themefile.setInt32( "menu_Content_Selected_Text_alpha",
g_settings.menu_Content_Selected_Text_alpha );
- themefile.setInt32( "menu_Content_Selected_Text_red",
g_settings.menu_Content_Selected_Text_red );
- themefile.setInt32( "menu_Content_Selected_Text_green",
g_settings.menu_Content_Selected_Text_green );
- themefile.setInt32( "menu_Content_Selected_Text_blue",
g_settings.menu_Content_Selected_Text_blue );
- themefile.setInt32( "menu_Content_inactive_alpha",
g_settings.menu_Content_inactive_alpha );
- themefile.setInt32( "menu_Content_inactive_red",
g_settings.menu_Content_inactive_red );
- themefile.setInt32( "menu_Content_inactive_green",
g_settings.menu_Content_inactive_green );
- themefile.setInt32( "menu_Content_inactive_blue",
g_settings.menu_Content_inactive_blue );
- themefile.setInt32( "menu_Content_inactive_Text_alpha",
g_settings.menu_Content_inactive_Text_alpha );
- themefile.setInt32( "menu_Content_inactive_Text_red",
g_settings.menu_Content_inactive_Text_red );
- themefile.setInt32( "menu_Content_inactive_Text_green",
g_settings.menu_Content_inactive_Text_green );
- themefile.setInt32( "menu_Content_inactive_Text_blue",
g_settings.menu_Content_inactive_Text_blue );
- themefile.setInt32( "infobar_alpha", g_settings.infobar_alpha );
- themefile.setInt32( "infobar_red", g_settings.infobar_red );
- themefile.setInt32( "infobar_green", g_settings.infobar_green );
- themefile.setInt32( "infobar_blue", g_settings.infobar_blue );
- themefile.setInt32( "infobar_Text_alpha", g_settings.infobar_Text_alpha
);
- themefile.setInt32( "infobar_Text_red", g_settings.infobar_Text_red );
- themefile.setInt32( "infobar_Text_green", g_settings.infobar_Text_green
);
- themefile.setInt32( "infobar_Text_blue", g_settings.infobar_Text_blue );
-
+ setColors(themefile);
if (!themefile.saveConfig(themename))
printf("[neutrino theme] %s write error\n", themename);
}
-
-
// setup default Color Sheme (Neutrino)
void CThemes::setupDefaultColors()
{
- g_settings.menu_Head_alpha = 0x00;
- g_settings.menu_Head_red = 0x00;
- g_settings.menu_Head_green = 0x0A;
- g_settings.menu_Head_blue = 0x19;
-
- g_settings.menu_Head_Text_alpha = 0x00;
- g_settings.menu_Head_Text_red = 0x5f;
- g_settings.menu_Head_Text_green = 0x46;
- g_settings.menu_Head_Text_blue = 0x00;
-
- g_settings.menu_Content_alpha = 0x14;
- g_settings.menu_Content_red = 0x00;
- g_settings.menu_Content_green = 0x0f;
- g_settings.menu_Content_blue = 0x23;
-
- g_settings.menu_Content_Text_alpha = 0x00;
- g_settings.menu_Content_Text_red = 0x64;
- g_settings.menu_Content_Text_green = 0x64;
- g_settings.menu_Content_Text_blue = 0x64;
-
- g_settings.menu_Content_Selected_alpha = 0x14;
- g_settings.menu_Content_Selected_red = 0x19;
- g_settings.menu_Content_Selected_green = 0x37;
- g_settings.menu_Content_Selected_blue = 0x64;
-
- g_settings.menu_Content_Selected_Text_alpha = 0x00;
- g_settings.menu_Content_Selected_Text_red = 0x00;
- g_settings.menu_Content_Selected_Text_green = 0x00;
- g_settings.menu_Content_Selected_Text_blue = 0x00;
-
- g_settings.menu_Content_inactive_alpha = 0x14;
- g_settings.menu_Content_inactive_red = 0x00;
- g_settings.menu_Content_inactive_green = 0x0f;
- g_settings.menu_Content_inactive_blue = 0x23;
-
- g_settings.menu_Content_inactive_Text_alpha = 0x00;
- g_settings.menu_Content_inactive_Text_red = 55;
- g_settings.menu_Content_inactive_Text_green = 70;
- g_settings.menu_Content_inactive_Text_blue = 85;
-
- g_settings.infobar_alpha = 0x14;
- g_settings.infobar_red = 0x00;
- g_settings.infobar_green = 0x0e;
- g_settings.infobar_blue = 0x23;
-
- g_settings.infobar_Text_alpha = 0x00;
- g_settings.infobar_Text_red = 0x64;
- g_settings.infobar_Text_green = 0x64;
- g_settings.infobar_Text_blue = 0x64;
+ CConfigFile empty(':');
+ getColors(empty);
+}
+
+void CThemes::getColors(CConfigFile &configfile)
+{
+ g_settings.menu_Head_alpha = configfile.getInt32( "menu_Head_alpha",
0x00 );
+ g_settings.menu_Head_red = configfile.getInt32( "menu_Head_red", 0x00 );
+ g_settings.menu_Head_green = configfile.getInt32( "menu_Head_green",
0x0A );
+ g_settings.menu_Head_blue = configfile.getInt32( "menu_Head_blue", 0x19
);
+ g_settings.menu_Head_Text_alpha = configfile.getInt32(
"menu_Head_Text_alpha", 0x00 );
+ g_settings.menu_Head_Text_red = configfile.getInt32(
"menu_Head_Text_red", 0x5f );
+ g_settings.menu_Head_Text_green = configfile.getInt32(
"menu_Head_Text_green", 0x46 );
+ g_settings.menu_Head_Text_blue = configfile.getInt32(
"menu_Head_Text_blue", 0x00 );
+ g_settings.menu_Content_alpha = configfile.getInt32(
"menu_Content_alpha", 0x14 );
+ g_settings.menu_Content_red = configfile.getInt32( "menu_Content_red",
0x00 );
+ g_settings.menu_Content_green = configfile.getInt32(
"menu_Content_green", 0x0f );
+ g_settings.menu_Content_blue = configfile.getInt32(
"menu_Content_blue", 0x23 );
+ g_settings.menu_Content_Text_alpha = configfile.getInt32(
"menu_Content_Text_alpha", 0x00 );
+ g_settings.menu_Content_Text_red = configfile.getInt32(
"menu_Content_Text_red", 0x64 );
+ g_settings.menu_Content_Text_green = configfile.getInt32(
"menu_Content_Text_green", 0x64 );
+ g_settings.menu_Content_Text_blue = configfile.getInt32(
"menu_Content_Text_blue", 0x64 );
+ g_settings.menu_Content_Selected_alpha = configfile.getInt32(
"menu_Content_Selected_alpha", 0x14 );
+ g_settings.menu_Content_Selected_red = configfile.getInt32(
"menu_Content_Selected_red", 0x19 );
+ g_settings.menu_Content_Selected_green = configfile.getInt32(
"menu_Content_Selected_green", 0x37 );
+ g_settings.menu_Content_Selected_blue = configfile.getInt32(
"menu_Content_Selected_blue", 0x64 );
+ g_settings.menu_Content_Selected_Text_alpha = configfile.getInt32(
"menu_Content_Selected_Text_alpha", 0x00 );
+ g_settings.menu_Content_Selected_Text_red = configfile.getInt32(
"menu_Content_Selected_Text_red", 0x00 );
+ g_settings.menu_Content_Selected_Text_green = configfile.getInt32(
"menu_Content_Selected_Text_green", 0x00 );
+ g_settings.menu_Content_Selected_Text_blue = configfile.getInt32(
"menu_Content_Selected_Text_blue", 0x00 );
+ g_settings.menu_Content_inactive_alpha = configfile.getInt32(
"menu_Content_inactive_alpha", 0x14 );
+ g_settings.menu_Content_inactive_red = configfile.getInt32(
"menu_Content_inactive_red", 0x00 );
+ g_settings.menu_Content_inactive_green = configfile.getInt32(
"menu_Content_inactive_green", 0x0f );
+ g_settings.menu_Content_inactive_blue = configfile.getInt32(
"menu_Content_inactive_blue", 0x23 );
+ g_settings.menu_Content_inactive_Text_alpha = configfile.getInt32(
"menu_Content_inactive_Text_alpha", 0x00 );
+ g_settings.menu_Content_inactive_Text_red = configfile.getInt32(
"menu_Content_inactive_Text_red", 55 );
+ g_settings.menu_Content_inactive_Text_green = configfile.getInt32(
"menu_Content_inactive_Text_green", 70 );
+ g_settings.menu_Content_inactive_Text_blue = configfile.getInt32(
"menu_Content_inactive_Text_blue", 85 );
+ g_settings.infobar_alpha = configfile.getInt32( "infobar_alpha", 0x14 );
+ g_settings.infobar_red = configfile.getInt32( "infobar_red", 0x00 );
+ g_settings.infobar_green = configfile.getInt32( "infobar_green", 0x0e );
+ g_settings.infobar_blue = configfile.getInt32( "infobar_blue", 0x23 );
+ g_settings.infobar_Text_alpha = configfile.getInt32(
"infobar_Text_alpha", 0x00 );
+ g_settings.infobar_Text_red = configfile.getInt32( "infobar_Text_red",
0x64 );
+ g_settings.infobar_Text_green = configfile.getInt32(
"infobar_Text_green", 0x64 );
+ g_settings.infobar_Text_blue = configfile.getInt32(
"infobar_Text_blue", 0x64 );
+}
+
+void CThemes::setColors(CConfigFile &configfile)
+{
+ configfile.setInt32( "menu_Head_alpha", g_settings.menu_Head_alpha );
+ configfile.setInt32( "menu_Head_red", g_settings.menu_Head_red );
+ configfile.setInt32( "menu_Head_green", g_settings.menu_Head_green );
+ configfile.setInt32( "menu_Head_blue", g_settings.menu_Head_blue );
+ configfile.setInt32( "menu_Head_Text_alpha",
g_settings.menu_Head_Text_alpha );
+ configfile.setInt32( "menu_Head_Text_red",
g_settings.menu_Head_Text_red );
+ configfile.setInt32( "menu_Head_Text_green",
g_settings.menu_Head_Text_green );
+ configfile.setInt32( "menu_Head_Text_blue",
g_settings.menu_Head_Text_blue );
+ configfile.setInt32( "menu_Content_alpha",
g_settings.menu_Content_alpha );
+ configfile.setInt32( "menu_Content_red", g_settings.menu_Content_red );
+ configfile.setInt32( "menu_Content_green",
g_settings.menu_Content_green );
+ configfile.setInt32( "menu_Content_blue", g_settings.menu_Content_blue
);
+ configfile.setInt32( "menu_Content_Text_alpha",
g_settings.menu_Content_Text_alpha );
+ configfile.setInt32( "menu_Content_Text_red",
g_settings.menu_Content_Text_red );
+ configfile.setInt32( "menu_Content_Text_green",
g_settings.menu_Content_Text_green );
+ configfile.setInt32( "menu_Content_Text_blue",
g_settings.menu_Content_Text_blue );
+ configfile.setInt32( "menu_Content_Selected_alpha",
g_settings.menu_Content_Selected_alpha );
+ configfile.setInt32( "menu_Content_Selected_red",
g_settings.menu_Content_Selected_red );
+ configfile.setInt32( "menu_Content_Selected_green",
g_settings.menu_Content_Selected_green );
+ configfile.setInt32( "menu_Content_Selected_blue",
g_settings.menu_Content_Selected_blue );
+ configfile.setInt32( "menu_Content_Selected_Text_alpha",
g_settings.menu_Content_Selected_Text_alpha );
+ configfile.setInt32( "menu_Content_Selected_Text_red",
g_settings.menu_Content_Selected_Text_red );
+ configfile.setInt32( "menu_Content_Selected_Text_green",
g_settings.menu_Content_Selected_Text_green );
+ configfile.setInt32( "menu_Content_Selected_Text_blue",
g_settings.menu_Content_Selected_Text_blue );
+ configfile.setInt32( "menu_Content_inactive_alpha",
g_settings.menu_Content_inactive_alpha );
+ configfile.setInt32( "menu_Content_inactive_red",
g_settings.menu_Content_inactive_red );
+ configfile.setInt32( "menu_Content_inactive_green",
g_settings.menu_Content_inactive_green );
+ configfile.setInt32( "menu_Content_inactive_blue",
g_settings.menu_Content_inactive_blue );
+ configfile.setInt32( "menu_Content_inactive_Text_alpha",
g_settings.menu_Content_inactive_Text_alpha );
+ configfile.setInt32( "menu_Content_inactive_Text_red",
g_settings.menu_Content_inactive_Text_red );
+ configfile.setInt32( "menu_Content_inactive_Text_green",
g_settings.menu_Content_inactive_Text_green );
+ configfile.setInt32( "menu_Content_inactive_Text_blue",
g_settings.menu_Content_inactive_Text_blue );
+ configfile.setInt32( "infobar_alpha", g_settings.infobar_alpha );
+ configfile.setInt32( "infobar_red", g_settings.infobar_red );
+ configfile.setInt32( "infobar_green", g_settings.infobar_green );
+ configfile.setInt32( "infobar_blue", g_settings.infobar_blue );
+ configfile.setInt32( "infobar_Text_alpha",
g_settings.infobar_Text_alpha );
+ configfile.setInt32( "infobar_Text_red", g_settings.infobar_Text_red );
+ configfile.setInt32( "infobar_Text_green",
g_settings.infobar_Text_green );
+ configfile.setInt32( "infobar_Text_blue", g_settings.infobar_Text_blue
);
}
bool CColorSetupNotifier::changeNotify(const neutrino_locale_t, void *)
diff --git a/tuxbox/neutrino/src/gui/themes.h b/tuxbox/neutrino/src/gui/themes.h
index f82015f..2148dcc 100644
--- a/tuxbox/neutrino/src/gui/themes.h
+++ b/tuxbox/neutrino/src/gui/themes.h
@@ -52,12 +52,15 @@ class CThemes : public CMenuTarget
void saveFile(char* themename);
void readThemes(CMenuWidget &);
void rememberOldTheme(bool remember);
+ void setupDefaultColors();
public:
CThemes(const neutrino_locale_t title =
LOCALE_COLORTHEMEMENU_HEAD2, const char * const IconName =
NEUTRINO_ICON_COLORS);
~CThemes();
- void setupDefaultColors();
int exec(CMenuTarget* parent, const std::string & actionKey);
+
+ static void getColors(CConfigFile &configfile);
+ static void setColors(CConfigFile &configfile);
};
#endif
diff --git a/tuxbox/neutrino/src/neutrino.cpp b/tuxbox/neutrino/src/neutrino.cpp
index ec360d9..6a1ebcb 100644
--- a/tuxbox/neutrino/src/neutrino.cpp
+++ b/tuxbox/neutrino/src/neutrino.cpp
@@ -107,6 +107,7 @@
#endif
#include "gui/rc_lock.h"
#include "gui/update.h"
+#include "gui/themes.h"
#include <system/setting_helpers.h>
#include <system/settings.h>
@@ -452,57 +453,9 @@ int CNeutrinoApp::loadSetup()
//widget settings
g_settings.widget_fade =
configfile.getBool("widget_fade" , true );
- //colors (neutrino defaultcolors)
- g_settings.menu_Head_alpha = configfile.getInt32( "menu_Head_alpha",
0x00 );
- g_settings.menu_Head_red = configfile.getInt32( "menu_Head_red", 0x00 );
- g_settings.menu_Head_green = configfile.getInt32( "menu_Head_green",
0x0A );
- g_settings.menu_Head_blue = configfile.getInt32( "menu_Head_blue", 0x19
);
-
- g_settings.menu_Head_Text_alpha = configfile.getInt32(
"menu_Head_Text_alpha", 0x00 );
- g_settings.menu_Head_Text_red = configfile.getInt32(
"menu_Head_Text_red", 0x5f );
- g_settings.menu_Head_Text_green = configfile.getInt32(
"menu_Head_Text_green", 0x46 );
- g_settings.menu_Head_Text_blue = configfile.getInt32(
"menu_Head_Text_blue", 0x00 );
-
- g_settings.menu_Content_alpha = configfile.getInt32(
"menu_Content_alpha", 0x14 );
- g_settings.menu_Content_red = configfile.getInt32( "menu_Content_red",
0x00 );
- g_settings.menu_Content_green = configfile.getInt32(
"menu_Content_green", 0x0f );
- g_settings.menu_Content_blue = configfile.getInt32(
"menu_Content_blue", 0x23 );
-
- g_settings.menu_Content_Text_alpha = configfile.getInt32(
"menu_Content_Text_alpha", 0x00 );
- g_settings.menu_Content_Text_red = configfile.getInt32(
"menu_Content_Text_red", 0x64 );
- g_settings.menu_Content_Text_green = configfile.getInt32(
"menu_Content_Text_green", 0x64 );
- g_settings.menu_Content_Text_blue = configfile.getInt32(
"menu_Content_Text_blue", 0x64 );
-
- g_settings.menu_Content_Selected_alpha = configfile.getInt32(
"menu_Content_Selected_alpha", 0x14 );
- g_settings.menu_Content_Selected_red = configfile.getInt32(
"menu_Content_Selected_red", 0x19 );
- g_settings.menu_Content_Selected_green = configfile.getInt32(
"menu_Content_Selected_green", 0x37 );
- g_settings.menu_Content_Selected_blue = configfile.getInt32(
"menu_Content_Selected_blue", 0x64 );
-
- g_settings.menu_Content_Selected_Text_alpha = configfile.getInt32(
"menu_Content_Selected_Text_alpha", 0x00 );
- g_settings.menu_Content_Selected_Text_red = configfile.getInt32(
"menu_Content_Selected_Text_red", 0x00 );
- g_settings.menu_Content_Selected_Text_green = configfile.getInt32(
"menu_Content_Selected_Text_green", 0x00 );
- g_settings.menu_Content_Selected_Text_blue = configfile.getInt32(
"menu_Content_Selected_Text_blue", 0x00 );
-
- g_settings.menu_Content_inactive_alpha = configfile.getInt32(
"menu_Content_inactive_alpha", 0x14 );
- g_settings.menu_Content_inactive_red = configfile.getInt32(
"menu_Content_inactive_red", 0x00 );
- g_settings.menu_Content_inactive_green = configfile.getInt32(
"menu_Content_inactive_green", 0x0f );
- g_settings.menu_Content_inactive_blue = configfile.getInt32(
"menu_Content_inactive_blue", 0x23 );
-
- g_settings.menu_Content_inactive_Text_alpha = configfile.getInt32(
"menu_Content_inactive_Text_alpha", 0x00 );
- g_settings.menu_Content_inactive_Text_red = configfile.getInt32(
"menu_Content_inactive_Text_red", 55 );
- g_settings.menu_Content_inactive_Text_green = configfile.getInt32(
"menu_Content_inactive_Text_green", 70 );
- g_settings.menu_Content_inactive_Text_blue = configfile.getInt32(
"menu_Content_inactive_Text_blue", 85 );
-
- g_settings.infobar_alpha = configfile.getInt32( "infobar_alpha", 0x14 );
- g_settings.infobar_red = configfile.getInt32( "infobar_red", 0x00 );
- g_settings.infobar_green = configfile.getInt32( "infobar_green", 0x0e );
- g_settings.infobar_blue = configfile.getInt32( "infobar_blue", 0x23 );
-
- g_settings.infobar_Text_alpha = configfile.getInt32(
"infobar_Text_alpha", 0x00 );
- g_settings.infobar_Text_red = configfile.getInt32( "infobar_Text_red",
0x64 );
- g_settings.infobar_Text_green = configfile.getInt32(
"infobar_Text_green", 0x64 );
- g_settings.infobar_Text_blue = configfile.getInt32(
"infobar_Text_blue", 0x64 );
-
+ //colors
+ CThemes::getColors(configfile);
+
//corners
g_settings.rounded_corners = configfile.getBool("rounded_corners",
true);
@@ -1040,56 +993,8 @@ void CNeutrinoApp::saveSetup()
configfile.setBool("widget_fade" , g_settings.widget_fade);
//colors
- configfile.setInt32( "menu_Head_alpha", g_settings.menu_Head_alpha );
- configfile.setInt32( "menu_Head_red", g_settings.menu_Head_red );
- configfile.setInt32( "menu_Head_green", g_settings.menu_Head_green );
- configfile.setInt32( "menu_Head_blue", g_settings.menu_Head_blue );
-
- configfile.setInt32( "menu_Head_Text_alpha",
g_settings.menu_Head_Text_alpha );
- configfile.setInt32( "menu_Head_Text_red",
g_settings.menu_Head_Text_red );
- configfile.setInt32( "menu_Head_Text_green",
g_settings.menu_Head_Text_green );
- configfile.setInt32( "menu_Head_Text_blue",
g_settings.menu_Head_Text_blue );
-
- configfile.setInt32( "menu_Content_alpha",
g_settings.menu_Content_alpha );
- configfile.setInt32( "menu_Content_red", g_settings.menu_Content_red );
- configfile.setInt32( "menu_Content_green",
g_settings.menu_Content_green );
- configfile.setInt32( "menu_Content_blue", g_settings.menu_Content_blue
);
-
- configfile.setInt32( "menu_Content_Text_alpha",
g_settings.menu_Content_Text_alpha );
- configfile.setInt32( "menu_Content_Text_red",
g_settings.menu_Content_Text_red );
- configfile.setInt32( "menu_Content_Text_green",
g_settings.menu_Content_Text_green );
- configfile.setInt32( "menu_Content_Text_blue",
g_settings.menu_Content_Text_blue );
-
- configfile.setInt32( "menu_Content_Selected_alpha",
g_settings.menu_Content_Selected_alpha );
- configfile.setInt32( "menu_Content_Selected_red",
g_settings.menu_Content_Selected_red );
- configfile.setInt32( "menu_Content_Selected_green",
g_settings.menu_Content_Selected_green );
- configfile.setInt32( "menu_Content_Selected_blue",
g_settings.menu_Content_Selected_blue );
-
- configfile.setInt32( "menu_Content_Selected_Text_alpha",
g_settings.menu_Content_Selected_Text_alpha );
- configfile.setInt32( "menu_Content_Selected_Text_red",
g_settings.menu_Content_Selected_Text_red );
- configfile.setInt32( "menu_Content_Selected_Text_green",
g_settings.menu_Content_Selected_Text_green );
- configfile.setInt32( "menu_Content_Selected_Text_blue",
g_settings.menu_Content_Selected_Text_blue );
-
- configfile.setInt32( "menu_Content_inactive_alpha",
g_settings.menu_Content_inactive_alpha );
- configfile.setInt32( "menu_Content_inactive_red",
g_settings.menu_Content_inactive_red );
- configfile.setInt32( "menu_Content_inactive_green",
g_settings.menu_Content_inactive_green );
- configfile.setInt32( "menu_Content_inactive_blue",
g_settings.menu_Content_inactive_blue );
-
- configfile.setInt32( "menu_Content_inactive_Text_alpha",
g_settings.menu_Content_inactive_Text_alpha );
- configfile.setInt32( "menu_Content_inactive_Text_red",
g_settings.menu_Content_inactive_Text_red );
- configfile.setInt32( "menu_Content_inactive_Text_green",
g_settings.menu_Content_inactive_Text_green );
- configfile.setInt32( "menu_Content_inactive_Text_blue",
g_settings.menu_Content_inactive_Text_blue );
-
- configfile.setInt32( "infobar_alpha", g_settings.infobar_alpha );
- configfile.setInt32( "infobar_red", g_settings.infobar_red );
- configfile.setInt32( "infobar_green", g_settings.infobar_green );
- configfile.setInt32( "infobar_blue", g_settings.infobar_blue );
-
- configfile.setInt32( "infobar_Text_alpha",
g_settings.infobar_Text_alpha );
- configfile.setInt32( "infobar_Text_red", g_settings.infobar_Text_red );
- configfile.setInt32( "infobar_Text_green",
g_settings.infobar_Text_green );
- configfile.setInt32( "infobar_Text_blue", g_settings.infobar_Text_blue
);
-
+ CThemes::setColors(configfile);
+
//corners
configfile.setBool( "rounded_corners", g_settings.rounded_corners );
commit 57f9c8b8f10d219e7f8e654939e15f63a194b2a0
Author: GetAway <get-a...@t-online.de>
Date: Fri Sep 12 11:12:59 2014 +0200
Port CS-tuxmail SSL Support
Signed-off-by: GetAway <get-a...@t-online.de>
Signed-off-by: Thilo Graf <d...@novatux.de>
diff --git a/tuxbox/plugins/tuxmail/daemon/Makefile.am
b/tuxbox/plugins/tuxmail/daemon/Makefile.am
index 2cf1aa6..6cfc701 100644
--- a/tuxbox/plugins/tuxmail/daemon/Makefile.am
+++ b/tuxbox/plugins/tuxmail/daemon/Makefile.am
@@ -2,4 +2,4 @@ bin_PROGRAMS = tuxmaild
tuxmaild_SOURCES = tuxmaild.c
-tuxmaild_LDADD = -lpthread
+tuxmaild_LDADD = -lpthread -lssl -lcrypto
diff --git a/tuxbox/plugins/tuxmail/daemon/tuxmaild.c
b/tuxbox/plugins/tuxmail/daemon/tuxmaild.c
index 65b34af..bd8de6a 100644
--- a/tuxbox/plugins/tuxmail/daemon/tuxmaild.c
+++ b/tuxbox/plugins/tuxmail/daemon/tuxmaild.c
@@ -66,6 +66,7 @@ int ReadConf()
fprintf(fd_conf, "SUSER0=\n");
fprintf(fd_conf, "SPASS0=\n");
fprintf(fd_conf, "INBOX0=\n");
+ fprintf(fd_conf, "SSL0=0\n");
fclose(fd_conf);
@@ -251,6 +252,14 @@ int ReadConf()
sscanf(ptr + 7, "%s",
account_db[index-'0'].inbox);
}
}
+ else if((ptr = strstr(line_buffer, "SSL")) && (*(ptr+4)
== '='))
+ {
+ char index = *(ptr+3);
+ if((index >= '0') && (index <= '9'))
+ {
+ sscanf(ptr + 5, "%d",
&account_db[index-'0'].ssl);
+ }
+ }
}
// check for update
@@ -359,6 +368,7 @@ int ReadConf()
fprintf(fd_conf, "SUSER%d=%s\n", loop,
account_db[loop].suser);
fprintf(fd_conf, "SPASS%d=%s\n", loop,
account_db[loop].spass);
fprintf(fd_conf, "INBOX%d=%s\n", loop,
account_db[loop].inbox);
+ fprintf(fd_conf, "SSL%d=%d\n", loop,
account_db[loop].ssl);
if(!account_db[loop + 1].name[0])
{
@@ -1444,7 +1454,7 @@ void writeFOut( char *s)
* SendPOPCommand (0=fail, 1=done)
******************************************************************************/
-int SendPOPCommand(int command, char *param)
+int SendPOPCommand(int command, char *param, int ssl)
{
struct hostent *server;
struct sockaddr_in SockAddr;
@@ -1511,6 +1521,48 @@ int SendPOPCommand(int command, char *param)
return 0;
}
+ if(ssl == 1)
+ {
+ // Init SSL struct
+ printf("TuxMailD <Init SSL for
POP3>\n");
+ c = malloc (sizeof (connection));
+ c->sslHandle = NULL;
+ c->sslContext = NULL;
+
+ SSL_load_error_strings ();
+ SSL_library_init ();
+
+ c->sslContext = SSL_CTX_new
(SSLv23_client_method ());
+ if (c->sslContext == NULL) {
+ slog ? syslog(LOG_DAEMON |
LOG_INFO, "could not set SSL client method") : printf("TuxMailD <could not set
SSL client method>\n");
+
+ ERR_print_errors_fp (stderr);
+ return 0;
+ }
+
+ c->sslHandle = SSL_new (c->sslContext);
+ if (c->sslHandle == NULL) {
+ slog ? syslog(LOG_DAEMON |
LOG_INFO, "could not create SSL struct for the connection") : printf("TuxMailD
<could not create SSL struct for the connection>\n");
+
+ ERR_print_errors_fp (stderr);
+ return 0;
+ }
+
+ if (!SSL_set_fd (c->sslHandle, sock)) {
+ slog ? syslog(LOG_DAEMON |
LOG_INFO, "could not connect SSL struct to the socket") : printf("TuxMailD
<could not connect SSL struct to socket>\n");
+
+ ERR_print_errors_fp (stderr);
+ return 0;
+ }
+
+ if (SSL_connect (c->sslHandle) != 1) {
+ slog ? syslog(LOG_DAEMON |
LOG_INFO, "could not handle SSL handshake") : printf("TuxMailD <could not
handle SSL handshake>\n");
+
+ ERR_print_errors_fp (stderr);
+ return 0;
+ }
+ }
+
break;
case USER:
@@ -1583,7 +1635,10 @@ int SendPOPCommand(int command, char *param)
}
}
- send(sock, send_buffer, strlen(send_buffer), 0);
+ if(ssl == 1)
+ SSL_write (c->sslHandle, send_buffer,
strlen(send_buffer));
+ else
+ send(sock, send_buffer, strlen(send_buffer), 0);
}
// get server response
@@ -1602,7 +1657,7 @@ int SendPOPCommand(int command, char *param)
if(command == RETR)
{
- while(recv(sock, &recv_buffer[3], 1, 0) > 0)
+ while((ssl == 1 ? SSL_read (c->sslHandle,
&recv_buffer[3], 1) : recv(sock, &recv_buffer[3], 1, 0)) > 0)
{
if((nRead) && (nRead < 75000))
{
@@ -1611,8 +1666,8 @@ int SendPOPCommand(int command, char *param)
}
// scan for header-end
- if(!nRead && recv_buffer[3] == '\n' && recv_buffer[1]
== '\n')
- {
+ if(!nRead && recv_buffer[3] == '\n' &&
recv_buffer[1] == '\n')
+ {
nRead++;
}
@@ -1630,7 +1685,7 @@ int SendPOPCommand(int command, char *param)
}
else
{
- while(recv(sock, &recv_buffer[stringindex], 1, 0) > 0)
+ while((ssl == 1 ? SSL_read (c->sslHandle,
&recv_buffer[stringindex], 1) : recv(sock, &recv_buffer[stringindex], 1, 0)) >
0)
{
if(command == TOP)
{
@@ -1869,6 +1924,19 @@ int SendPOPCommand(int command, char *param)
case QUIT:
close(sock);
+
+ if(ssl == 1)
+ {
+ if (c->sslHandle)
+ {
+ SSL_shutdown
(c->sslHandle);
+ SSL_free (c->sslHandle);
+ }
+ if (c->sslContext)
+ SSL_CTX_free
(c->sslContext);
+
+ free (c);
+ }
}
}
else
@@ -1882,6 +1950,19 @@ int SendPOPCommand(int command, char *param)
close(sock);
+ if(ssl == 1)
+ {
+ if (c->sslHandle)
+ {
+ SSL_shutdown (c->sslHandle);
+ SSL_free (c->sslHandle);
+ }
+ if (c->sslContext)
+ SSL_CTX_free (c->sslContext);
+
+ free (c);
+ }
+
return 0;
}
@@ -1892,7 +1973,7 @@ int SendPOPCommand(int command, char *param)
* SendIMAPCommand (0=fail, 1=done)
******************************************************************************/
-int SendIMAPCommand(int command, char *param, char *param2)
+int SendIMAPCommand(int command, char *param, char *param2, int ssl)
{
struct hostent *server;
struct sockaddr_in SockAddr;
@@ -1959,6 +2040,48 @@ int SendIMAPCommand(int command, char *param, char
*param2)
return 0;
}
+ if(ssl == 1)
+ {
+ // Init SSL struct
+ printf("TuxMailD <Init SSL for
IMAP>\n");
+ c = malloc (sizeof (connection));
+ c->sslHandle = NULL;
+ c->sslContext = NULL;
+
+ SSL_load_error_strings ();
+ SSL_library_init ();
+
+ c->sslContext = SSL_CTX_new
(SSLv23_client_method ());
+ if (c->sslContext == NULL) {
+ slog ? syslog(LOG_DAEMON |
LOG_INFO, "could not set SSL client method") : printf("TuxMailD <could not set
SSL client method>\n");
+
+ ERR_print_errors_fp (stderr);
+ return 0;
+ }
+
+ c->sslHandle = SSL_new (c->sslContext);
+ if (c->sslHandle == NULL) {
+ slog ? syslog(LOG_DAEMON |
LOG_INFO, "could not create SSL struct for the connection") : printf("TuxMailD
<could not create SSL struct for the connection>\n");
+
+ ERR_print_errors_fp (stderr);
+ return 0;
+ }
+
+ if (!SSL_set_fd (c->sslHandle, sock)) {
+ slog ? syslog(LOG_DAEMON |
LOG_INFO, "could not connect SSL struct to the socket") : printf("TuxMailD
<could not connect SSL struct to socket>\n");
+
+ ERR_print_errors_fp (stderr);
+ return 0;
+ }
+
+ if (SSL_connect (c->sslHandle) != 1) {
+ slog ? syslog(LOG_DAEMON |
LOG_INFO, "could not handle SSL handshake") : printf("TuxMailD <could not
handle SSL handshake>\n");
+
+ ERR_print_errors_fp (stderr);
+ return 0;
+ }
+ }
+
break;
case LOGIN:
@@ -2053,7 +2176,10 @@ int SendIMAPCommand(int command, char *param, char
*param2)
}
}
- send(sock, send_buffer, strlen(send_buffer), 0);
+ if(ssl == 1)
+ SSL_write (c->sslHandle, send_buffer,
strlen(send_buffer));
+ else
+ send(sock, send_buffer, strlen(send_buffer), 0);
}
// get server response
@@ -2072,7 +2198,7 @@ int SendIMAPCommand(int command, char *param, char
*param2)
if(command == RETR)
{
- while(recv(sock, &recv_buffer[stringindex], 1, 0) > 0)
+ while((ssl == 1 ? SSL_read (c->sslHandle,
&recv_buffer[stringindex], 1) : recv(sock, &recv_buffer[stringindex], 1, 0)) >
0)
{
// read line by line
if((nRead) && (nRead < 75000))
@@ -2127,7 +2253,7 @@ int SendIMAPCommand(int command, char *param, char
*param2)
}
else
{
- while(recv(sock, &recv_buffer[stringindex], 1, 0) > 0)
+ while((ssl == 1 ? SSL_read (c->sslHandle,
&recv_buffer[stringindex], 1) : recv(sock, &recv_buffer[stringindex], 1, 0)) >
0)
{
// read line by line and end if leading
character hast been '?' or after one line after INIT
if(recv_buffer[stringindex] == '\n')
@@ -2439,6 +2565,20 @@ int SendIMAPCommand(int command, char *param, char
*param2)
case LOGOUT:
close(sock);
+
+ if(ssl == 1)
+ {
+ if (c->sslHandle)
+ {
+ SSL_shutdown
(c->sslHandle);
+ SSL_free (c->sslHandle);
+ }
+ if (c->sslContext)
+ SSL_CTX_free
(c->sslContext);
+
+ free (c);
+ }
+
return 1;
default:
@@ -2448,6 +2588,19 @@ int SendIMAPCommand(int command, char *param, char
*param2)
slog ? syslog(LOG_DAEMON | LOG_INFO, "IMAP Server (%s)", recv_buffer) :
printf("TuxMailD <IMAP Server (%s)>\n", recv_buffer);
close(sock);
+
+ if(ssl == 1)
+ {
+ if (c->sslHandle)
+ {
+ SSL_shutdown (c->sslHandle);
+ SSL_free (c->sslHandle);
+ }
+ if (c->sslContext)
+ SSL_CTX_free (c->sslContext);
+ free (c);
+ }
+
return 0;
}
@@ -2455,7 +2608,7 @@ int SendIMAPCommand(int command, char *param, char
*param2)
* SendSMTPCommand (0=fail, 1=done)
******************************************************************************/
-int SendSMTPCommand(int command, char *param)
+int SendSMTPCommand(int command, char *param, int ssl)
{
FILE *fd_log;
static int sock;
@@ -2518,6 +2671,48 @@ int SendSMTPCommand(int command, char *param)
return 0;
}
+ if(ssl == 1)
+ {
+ // Init SSL struct
+ printf("TuxMailD <Init SSL for
SMTP>\n");
+ c = malloc (sizeof (connection));
+ c->sslHandle = NULL;
+ c->sslContext = NULL;
+
+ SSL_load_error_strings ();
+ SSL_library_init ();
+
+ c->sslContext = SSL_CTX_new
(SSLv23_client_method ());
+ if (c->sslContext == NULL) {
+ slog ? syslog(LOG_DAEMON |
LOG_INFO, "could not set SSL client method") : printf("TuxMailD <could not set
SSL client method>\n");
+
+ ERR_print_errors_fp (stderr);
+ return 0;
+ }
+
+ c->sslHandle = SSL_new (c->sslContext);
+ if (c->sslHandle == NULL) {
+ slog ? syslog(LOG_DAEMON |
LOG_INFO, "could not create SSL struct for the connection") : printf("TuxMailD
<could not create SSL struct for the connection>\n");
+
+ ERR_print_errors_fp (stderr);
+ return 0;
+ }
+
+ if (!SSL_set_fd (c->sslHandle, sock)) {
+ slog ? syslog(LOG_DAEMON |
LOG_INFO, "could not connect SSL struct to the socket") : printf("TuxMailD
<could not connect SSL struct to socket>\n");
+
+ ERR_print_errors_fp (stderr);
+ return 0;
+ }
+
+ if (SSL_connect (c->sslHandle) != 1) {
+ slog ? syslog(LOG_DAEMON |
LOG_INFO, "could not handle SSL handshake") : printf("TuxMailD <could not
handle SSL handshake>\n");
+
+ ERR_print_errors_fp (stderr);
+ return 0;
+ }
+ }
+
break;
case EHLO:
@@ -2583,7 +2778,10 @@ int SendSMTPCommand(int command, char *param)
}
}
- send(sock, &send_buffer, strlen(send_buffer), 0);
+ if(ssl == 1)
+ SSL_write (c->sslHandle, &send_buffer,
strlen(send_buffer));
+ else
+ send(sock, &send_buffer, strlen(send_buffer),
0);
}
// get server response
@@ -2596,7 +2794,10 @@ int SendSMTPCommand(int command, char *param)
return 1;
}
- recv(sock, &recv_buffer, sizeof(recv_buffer), 0);
+ if(ssl == 1)
+ SSL_read (c->sslHandle, &recv_buffer,
sizeof(recv_buffer));
+ else
+ recv(sock, &recv_buffer, sizeof(recv_buffer), 0);
if(logging == 'Y')
{
@@ -2659,6 +2860,19 @@ int SendSMTPCommand(int command, char *param)
close(sock);
+ if(ssl == 1)
+ {
+ if (c->sslHandle)
+ {
+ SSL_shutdown (c->sslHandle);
+ SSL_free (c->sslHandle);
+ }
+ if (c->sslContext)
+ SSL_CTX_free (c->sslContext);
+
+ free (c);
+ }
+
if(strncmp(recv_buffer, "221", 3))
{
return 0;
@@ -2685,11 +2899,22 @@ int SendSMTPCommand(int command, char *param)
}
}
- send(sock, &send_buffer, strlen(send_buffer), 0);
+ if(ssl == 1)
+ {
+ SSL_write (c->sslHandle, send_buffer,
strlen(send_buffer));
- memset(recv_buffer, 0, sizeof(recv_buffer));
+ memset(recv_buffer, 0, sizeof(recv_buffer));
- recv(sock, &recv_buffer, sizeof(recv_buffer), 0);
+ SSL_read (c->sslHandle, &recv_buffer,
sizeof(recv_buffer));
+ }
+ else
+ {
+ send(sock, &send_buffer, strlen(send_buffer),
0);
+
+ memset(recv_buffer, 0, sizeof(recv_buffer));
+
+ recv(sock, &recv_buffer, sizeof(recv_buffer),
0);
+ }
if(logging == 'Y')
{
@@ -2707,6 +2932,19 @@ int SendSMTPCommand(int command, char *param)
close(sock);
+ if(ssl == 1)
+ {
+ if (c->sslHandle)
+ {
+ SSL_shutdown (c->sslHandle);
+ SSL_free (c->sslHandle);
+ }
+ if (c->sslContext)
+ SSL_CTX_free (c->sslContext);
+
+ free (c);
+ }
+
return 0;
}
@@ -2739,7 +2977,7 @@ int SendMail(int account)
{
linebuffer[strlen(linebuffer) - 1] = '\0';
- if(!SendSMTPCommand(INIT, linebuffer))
+ if(!SendSMTPCommand(INIT, linebuffer,
account_db[account].ssl))
{
fclose(mail);
@@ -2755,7 +2993,7 @@ int SendMail(int account)
{
linebuffer[strlen(linebuffer) - 1] = '\0';
- if(!SendSMTPCommand(EHLO, linebuffer))
+ if(!SendSMTPCommand(EHLO, linebuffer,
account_db[account].ssl))
{
fclose(mail);
@@ -2781,7 +3019,7 @@ int SendMail(int account)
EncodeBase64(decodedstring,
strlen(account_db[account].suser) + strlen(account_db[account].spass) + 2);
}
- if(!SendSMTPCommand(AUTH, encodedstring))
+ if(!SendSMTPCommand(AUTH, encodedstring,
account_db[account].ssl))
{
fclose(mail);
@@ -2796,7 +3034,7 @@ int SendMail(int account)
{
linebuffer[strlen(linebuffer) - 1] = '\0';
- if(!SendSMTPCommand(MAIL, linebuffer))
+ if(!SendSMTPCommand(MAIL, linebuffer,
account_db[account].ssl))
{
fclose(mail);
@@ -2812,7 +3050,7 @@ int SendMail(int account)
{
linebuffer[strlen(linebuffer) - 1] = '\0';
- if(!SendSMTPCommand(RCPT, linebuffer))
+ if(!SendSMTPCommand(RCPT, linebuffer,
account_db[account].ssl))
{
fclose(mail);
@@ -2822,7 +3060,7 @@ int SendMail(int account)
// send data
- if(!SendSMTPCommand(DATA1, ""))
+ if(!SendSMTPCommand(DATA1, "", account_db[account].ssl))
{
fclose(mail);
@@ -2835,7 +3073,7 @@ int SendMail(int account)
{
linebuffer[strlen(linebuffer) - 1] = '\0';
- if(!SendSMTPCommand(DATA2, linebuffer))
+ if(!SendSMTPCommand(DATA2, linebuffer,
account_db[account].ssl))
{
fclose(mail);
@@ -2845,7 +3083,7 @@ int SendMail(int account)
memset(linebuffer, 0, sizeof(linebuffer));
}
- if(!SendSMTPCommand(DATA3, ""))
+ if(!SendSMTPCommand(DATA3, "", account_db[account].ssl))
{
fclose(mail);
@@ -2854,7 +3092,7 @@ int SendMail(int account)
// send quit
- if(!SendSMTPCommand(QUIT, ""))
+ if(!SendSMTPCommand(QUIT, "", account_db[account].ssl))
{
fclose(mail);
@@ -2892,7 +3130,7 @@ int SaveMail(int account, char* mailuid)
if( !imap1 )
{
- if(!SendPOPCommand(INIT, account_db[account].pop3))
+ if(!SendPOPCommand(INIT, account_db[account].pop3,
account_db[account].ssl))
{
if(fd_mail)
{
@@ -2902,7 +3140,7 @@ int SaveMail(int account, char* mailuid)
return 0;
}
- if(!SendPOPCommand(USER, account_db[account].user))
+ if(!SendPOPCommand(USER, account_db[account].user,
account_db[account].ssl))
{
if(fd_mail)
{
@@ -2912,7 +3150,7 @@ int SaveMail(int account, char* mailuid)
return 0;
}
- if(!SendPOPCommand(PASS, account_db[account].pass))
+ if(!SendPOPCommand(PASS, account_db[account].pass,
account_db[account].ssl))
{
if(fd_mail)
{
@@ -2922,7 +3160,7 @@ int SaveMail(int account, char* mailuid)
return 0;
}
- if(!SendPOPCommand(STAT, ""))
+ if(!SendPOPCommand(STAT, "", account_db[account].ssl))
{
if(fd_mail)
{
@@ -2934,7 +3172,7 @@ int SaveMail(int account, char* mailuid)
}
else
{
- if(!SendIMAPCommand(INIT, account_db[account].imap, ""))
+ if(!SendIMAPCommand(INIT, account_db[account].imap, "",
account_db[account].ssl))
{
if(fd_mail)
{
@@ -2945,7 +3183,7 @@ int SaveMail(int account, char* mailuid)
}
// login to mail server
- if(!SendIMAPCommand(LOGIN, account_db[account].user,
account_db[account].pass))
+ if(!SendIMAPCommand(LOGIN, account_db[account].user,
account_db[account].pass, account_db[account].ssl))
{
if(fd_mail)
{
@@ -2956,7 +3194,7 @@ int SaveMail(int account, char* mailuid)
}
// select folder, get mail count and UID
- if(!SendIMAPCommand(SELECT, account_db[account].inbox,
""))
+ if(!SendIMAPCommand(SELECT, account_db[account].inbox,
"", account_db[account].ssl))
{
if(fd_mail)
{
@@ -2977,7 +3215,7 @@ int SaveMail(int account, char* mailuid)
if( !imap1 )
{
- if(!SendPOPCommand(UIDL, mailnumber))
+ if(!SendPOPCommand(UIDL, mailnumber,
account_db[account].ssl))
{
if(fd_mail)
{
@@ -2989,7 +3227,7 @@ int SaveMail(int account, char* mailuid)
}
else
{
- if(!SendIMAPCommand(UIDL, mailnumber, ""))
+ if(!SendIMAPCommand(UIDL, mailnumber, "",
account_db[account].ssl))
{
if(fd_mail)
{
@@ -3007,7 +3245,7 @@ int SaveMail(int account, char* mailuid)
if( !imap1 )
{
- if(!SendPOPCommand(RETR, mailnumber))
+ if(!SendPOPCommand(RETR, mailnumber,
account_db[account].ssl))
{
if(fd_mail)
{
@@ -3018,12 +3256,12 @@ int SaveMail(int account, char* mailuid)
}
fclose(fd_mail);
- SendPOPCommand(QUIT, "");
+ SendPOPCommand(QUIT, "",
account_db[account].ssl);
}
else
{
char seen = 0;
- if(!SendIMAPCommand(FLAGS, mailnumber,
&seen))
+ if(!SendIMAPCommand(FLAGS, mailnumber,
&seen, account_db[account].ssl))
{
if(fd_mail)
{
@@ -3033,7 +3271,7 @@ int SaveMail(int account, char* mailuid)
return 0;
}
- if((!seen) || (!SendIMAPCommand(RETR,
mailnumber, "")))
+ if((!seen) || (!SendIMAPCommand(RETR,
mailnumber, "", account_db[account].ssl)))
{
if(fd_mail)
{
@@ -3045,7 +3283,7 @@ int SaveMail(int account, char* mailuid)
if( seen == 'U' )
{
- if(!SendIMAPCommand(UNSEEN,
mailnumber, ""))
+ if(!SendIMAPCommand(UNSEEN,
mailnumber, "", account_db[account].ssl))
{
if(fd_mail)
{
@@ -3057,7 +3295,7 @@ int SaveMail(int account, char* mailuid)
}
fclose(fd_mail);
- SendIMAPCommand(LOGOUT, "", "");
+ SendIMAPCommand(LOGOUT, "", "",
account_db[account].ssl);
}
return 1;
@@ -3068,11 +3306,11 @@ int SaveMail(int account, char* mailuid)
if( !imap1 )
{
- SendPOPCommand(QUIT, "");
+ SendPOPCommand(QUIT, "", account_db[account].ssl);
}
else
{
- SendIMAPCommand(LOGOUT, "", "");
+ SendIMAPCommand(LOGOUT, "", "",
account_db[account].ssl);
}
}
@@ -3331,7 +3569,7 @@ int AddNewMailFile(int account, char *mailnumber, FILE
*fd_status)
{
if( !imap )
{
- if(!SendPOPCommand(RETR, mailnumber))
+ if(!SendPOPCommand(RETR, mailnumber,
account_db[account].ssl))
{
idx1 = 0;
fclose(fd_mail);
@@ -3348,12 +3586,12 @@ int AddNewMailFile(int account, char *mailnumber, FILE
*fd_status)
{
char seen=0;
- if(!SendIMAPCommand(FLAGS, mailnumber, &seen))
+ if(!SendIMAPCommand(FLAGS, mailnumber, &seen,
account_db[account].ssl))
{
seen=0;
}
- if((!seen) || (!SendIMAPCommand(RETR,
mailnumber, "")))
+ if((!seen) || (!SendIMAPCommand(RETR,
mailnumber, "", account_db[account].ssl)))
{
// printf("error write email nr: %s at
%stuxmail.idx%u.%u\n",mailnumber,maildir,account,idx1);
idx1 = 0;
@@ -3364,7 +3602,7 @@ int AddNewMailFile(int account, char *mailnumber, FILE
*fd_status)
// printf("write email nr: %s at
%stuxmail.idx%u.%u\n",mailnumber,maildir,account,idx1);
if( seen == 'U' )
{
- SendIMAPCommand(UNSEEN,
mailnumber, "");
+ SendIMAPCommand(UNSEEN,
mailnumber, "", account_db[account].ssl);
}
fclose(fd_mail);
@@ -3429,19 +3667,19 @@ int CheckAccount(int account)
imap = 1;
// init connection to server
- if(!SendIMAPCommand(INIT, account_db[account].imap, ""))
+ if(!SendIMAPCommand(INIT, account_db[account].imap, "",
account_db[account].ssl))
{
return 0;
}
// login to mail server
- if(!SendIMAPCommand(LOGIN, account_db[account].user,
account_db[account].pass))
+ if(!SendIMAPCommand(LOGIN, account_db[account].user,
account_db[account].pass, account_db[account].ssl))
{
return 0;
}
// select folder, get mail count and UID
- if(!SendIMAPCommand(SELECT, account_db[account].inbox, ""))
+ if(!SendIMAPCommand(SELECT, account_db[account].inbox, "",
account_db[account].ssl))
{
return 0;
}
@@ -3449,27 +3687,27 @@ int CheckAccount(int account)
else
{
// get mail count
- if(!SendPOPCommand(INIT, account_db[account].pop3))
+ if(!SendPOPCommand(INIT, account_db[account].pop3,
account_db[account].ssl))
{
return 0;
}
- if(!SendPOPCommand(USER, account_db[account].user))
+ if(!SendPOPCommand(USER, account_db[account].user,
account_db[account].ssl))
{
return 0;
}
- if(!SendPOPCommand(PASS, account_db[account].pass))
+ if(!SendPOPCommand(PASS, account_db[account].pass,
account_db[account].ssl))
{
return 0;
}
- if(!SendPOPCommand(STAT, ""))
+ if(!SendPOPCommand(STAT, "", account_db[account].ssl))
{
return 0;
}
- if(!SendPOPCommand(RSET, ""))
+ if(!SendPOPCommand(RSET, "", account_db[account].ssl))
{
return 0;
}
@@ -3543,7 +3781,7 @@ int CheckAccount(int account)
if( !imap )
{
- if(!SendPOPCommand(UIDL,
mailnumber))
+ if(!SendPOPCommand(UIDL,
mailnumber, account_db[account].ssl))
{
free(known_uids);
@@ -3557,7 +3795,7 @@ int CheckAccount(int account)
}
else
{
- if(!SendIMAPCommand(UIDL,
mailnumber, ""))
+ if(!SendIMAPCommand(UIDL,
mailnumber, "", account_db[account].ssl))
{
free(known_uids);
@@ -3574,7 +3812,7 @@ int CheckAccount(int account)
{
if( !imap )
{
- if(!SendPOPCommand(TOP,
mailnumber))
+ if(!SendPOPCommand(TOP,
mailnumber, account_db[account].ssl))
{
free(known_uids);
@@ -3589,7 +3827,7 @@ int CheckAccount(int account)
else
{
char seen;
-
if(!SendIMAPCommand(FLAGS, mailnumber, &seen))
+
if(!SendIMAPCommand(FLAGS, mailnumber, &seen, account_db[account].ssl))
{
free(known_uids);
@@ -3601,7 +3839,7 @@ int CheckAccount(int account)
return 0;
}
-
if(!SendIMAPCommand(FETCH, mailnumber, ""))
+
if(!SendIMAPCommand(FETCH, mailnumber, "", account_db[account].ssl))
{
free(known_uids);
@@ -3615,7 +3853,7 @@ int CheckAccount(int account)
if( seen == 'U' )
{
-
if(!SendIMAPCommand(UNSEEN, mailnumber, ""))
+
if(!SendIMAPCommand(UNSEEN, mailnumber, "", account_db[account].ssl))
{
free(known_uids);
@@ -3635,7 +3873,7 @@ int CheckAccount(int account)
if( !imap )
{
-
if(!SendPOPCommand(DELE, mailnumber))
+
if(!SendPOPCommand(DELE, mailnumber, account_db[account].ssl))
{
free(known_uids);
@@ -3649,7 +3887,7 @@ int CheckAccount(int account)
}
else
{
-
if(!SendIMAPCommand(DELE, mailnumber, ""))
+
if(!SendIMAPCommand(DELE, mailnumber, "", account_db[account].ssl))
{
free(known_uids);
@@ -3689,7 +3927,7 @@ int CheckAccount(int account)
{
if( !imap )
{
-
if(!SendPOPCommand(DELE, mailnumber))
+
if(!SendPOPCommand(DELE, mailnumber, account_db[account].ssl))
{
free(known_uids);
@@ -3703,7 +3941,7 @@ int CheckAccount(int account)
}
else
{
-
if(!SendIMAPCommand(DELE, mailnumber, ""))
+
if(!SendIMAPCommand(DELE, mailnumber, "", account_db[account].ssl))
{
free(known_uids);
@@ -3756,7 +3994,7 @@ int CheckAccount(int account)
{
if( !imap )
{
-
if(!SendPOPCommand(TOP, mailnumber))
+
if(!SendPOPCommand(TOP, mailnumber, account_db[account].ssl))
{
free(known_uids);
@@ -3771,7 +4009,7 @@ int CheckAccount(int account)
else
{
char seen;
-
if(!SendIMAPCommand(FLAGS, mailnumber, &seen))
+
if(!SendIMAPCommand(FLAGS, mailnumber, &seen, account_db[account].ssl))
{
free(known_uids);
@@ -3783,7 +4021,7 @@ int CheckAccount(int account)
return
0;
}
-
if(!SendIMAPCommand(FETCH, mailnumber, ""))
+
if(!SendIMAPCommand(FETCH, mailnumber, "", account_db[account].ssl))
{
free(known_uids);
@@ -3797,7 +4035,7 @@ int CheckAccount(int account)
if( seen == 'U'
)
{
-
if(!SendIMAPCommand(UNSEEN, mailnumber, ""))
+
if(!SendIMAPCommand(UNSEEN, mailnumber, "", account_db[account].ssl))
{
free(known_uids);
@@ -3815,7 +4053,7 @@ int CheckAccount(int account)
{
if( !imap )
{
-
if(!SendPOPCommand(DELE, mailnumber))
+
if(!SendPOPCommand(DELE, mailnumber, account_db[account].ssl))
{
free(known_uids);
@@ -3829,7 +4067,7 @@ int CheckAccount(int account)
}
else
{
-
if(!SendIMAPCommand(DELE, mailnumber, ""))
+
if(!SendIMAPCommand(DELE, mailnumber, "", account_db[account].ssl))
{
free(known_uids);
@@ -3934,7 +4172,7 @@ int CheckAccount(int account)
if(( !deleted_messages ) && ( !imap ))
{
- if(!SendPOPCommand(RSET, ""))
+ if(!SendPOPCommand(RSET, "",
account_db[account].ssl))
{
return 0;
}
@@ -3979,22 +4217,22 @@ int CheckAccount(int account)
if( !imap )
{
- if(!SendPOPCommand(QUIT, ""))
+ if(!SendPOPCommand(QUIT, "", account_db[account].ssl))
{
return 0;
}
}
else
{
- if(!SendIMAPCommand(EXPUNGE, "", ""))
+ if(!SendIMAPCommand(EXPUNGE, "", "",
account_db[account].ssl))
{
return 0;
}
- if(!SendIMAPCommand(CLOSE, "", ""))
+ if(!SendIMAPCommand(CLOSE, "", "",
account_db[account].ssl))
{
return 0;
}
- if(!SendIMAPCommand(LOGOUT, "", ""))
+ if(!SendIMAPCommand(LOGOUT, "", "",
account_db[account].ssl))
{
return 0;
}
@@ -4556,7 +4794,7 @@ void SigHandler(int signal)
int main(int argc, char **argv)
{
- char cvs_revision[] = "$Revision: 1.51 $";
+ char cvs_revision[] = "$Revision: 1.51A $";
int param, nodelay = 0, account, mailstatus, unread_mailstatus;
pthread_t thread_id;
void *thread_result = 0;
@@ -4671,7 +4909,7 @@ int main(int argc, char **argv)
{
case 0:
- slog ? syslog(LOG_DAEMON | LOG_INFO, "%s
started [%s]", versioninfo, timeinfo) : printf("TuxMailD %s started [%s]\n",
versioninfo, timeinfo);
+ slog ? syslog(LOG_DAEMON | LOG_INFO, "%s
started [%s]", versioninfo, timeinfo) : printf("TuxMailD %s (with SSL support)
started [%s]\n", versioninfo, timeinfo);
setsid();
chdir("/");
diff --git a/tuxbox/plugins/tuxmail/daemon/tuxmaild.h
b/tuxbox/plugins/tuxmail/daemon/tuxmaild.h
index 9a30e63..06c024f 100644
--- a/tuxbox/plugins/tuxmail/daemon/tuxmaild.h
+++ b/tuxbox/plugins/tuxmail/daemon/tuxmaild.h
@@ -21,6 +21,10 @@
#include <arpa/inet.h>
#include <syslog.h>
+#include <openssl/rand.h>
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+
#include "audio.h"
#define DSP "/dev/sound/dsp"
@@ -157,6 +161,7 @@ struct
int mail_new;
int mail_unread;
int mail_read;
+ int ssl;
}account_db[10];
@@ -195,6 +200,14 @@ struct CHUNK
unsigned long ChunkSize;
};
+// SSL
+typedef struct {
+ SSL *sslHandle;
+ SSL_CTX *sslContext;
+} connection;
+
+connection *c;
+
// some data
char versioninfo[12];
diff --git a/tuxbox/plugins/tuxmail/tuxmail.c b/tuxbox/plugins/tuxmail/tuxmail.c
index 204bce1..42abecc 100644
--- a/tuxbox/plugins/tuxmail/tuxmail.c
+++ b/tuxbox/plugins/tuxmail/tuxmail.c
@@ -201,6 +201,14 @@ void ReadConf()
sscanf(ptr + 7, "%s",
maildb[index-'0'].inbox);
}
}
+ else if ( ( ptr = strstr ( line_buffer, "SSL" ) ) && (
* ( ptr+4 ) == '=' ) )
+ {
+ char index = * ( ptr+3 );
+ if ( ( index >= '0' ) && ( index <= '9' ) )
+ {
+ sscanf ( ptr + 5, "%d",
&maildb[index-'0'].ssl );
+ }
+ }
}
fclose(fd_conf);
@@ -287,6 +295,7 @@ int WriteConf()
fprintf(fd_conf, "SUSER%d=%s\n", loop, maildb[loop].suser);
fprintf(fd_conf, "SPASS%d=%s\n", loop, maildb[loop].spass);
fprintf(fd_conf, "INBOX%d=%s\n", loop, maildb[loop].inbox);
+ fprintf(fd_conf, "SSL%d=%d\n", loop, maildb[loop].ssl );
if(!maildb[loop + 1].user[0])
{
break;
@@ -1459,7 +1468,7 @@ void PaintSmtpMailHeader( int nEditDirectStyle , int
nConfigPage)
RenderString(linebuffer, 2*BORDERSIZE+380,
BORDERSIZE+3*FONTHEIGHT_SMALL-6 , VIEWX-4*BORDERSIZE, LEFT, NORMAL, WHITE);
int i;
- for( i=2; i<14; i++)
+ for( i=2; i<15; i++)
{
switch( i )
{
@@ -1515,6 +1524,13 @@ void PaintSmtpMailHeader( int nEditDirectStyle , int
nConfigPage)
strcpy(linebuffer, "INBOX:");
strcpy(szInfo[i],maildb[nConfigPage].inbox);
break;
+ case 14:
+ strcpy(linebuffer, "SSL" );
+
sprintf(szInfo[i],"%d",maildb[nConfigPage].ssl);
+ break;
+ default:
+ linebuffer[0]='\0';
+ szInfo[i][0]='\0';
}
RenderString( linebuffer, 2*BORDERSIZE,
BORDERSIZE+(2+i)*FONTHEIGHT_SMALL , VIEWX-4*BORDERSIZE, LEFT, SMALL, ORANGE);
}
@@ -1527,7 +1543,7 @@ void PaintSmtpMailHeader( int nEditDirectStyle , int
nConfigPage)
if( nConfigPage == 10 )
{
int i;
- for( i=2; i<13; i++)
+ for( i=2; i<14; i++)
{
switch( i )
{
@@ -1574,7 +1590,9 @@ void PaintSmtpMailHeader( int nEditDirectStyle , int
nConfigPage)
case 12:
strcpy(linebuffer,
"TYPEFLAG:");
sprintf(szInfo[i],"%d",typeflag);
- break;
+ break;
+ linebuffer[0]='\0';
+ szInfo[i][0]='\0';
}
RenderString( linebuffer, 2*BORDERSIZE,
BORDERSIZE+(2+i)*FONTHEIGHT_SMALL , VIEWX-4*BORDERSIZE, LEFT, SMALL, ORANGE);
}
@@ -1582,7 +1600,7 @@ void PaintSmtpMailHeader( int nEditDirectStyle , int
nConfigPage)
else
{
int i;
- for( i=2; i<12; i++)
+ for( i=2; i<14; i++)
{
switch( i )
{
@@ -1660,7 +1678,7 @@ void SaveConfigMailBox(int nConfigPage)
if( nConfigPage < 10 )
{
int i;
- for( i=2; i<14; i++)
+ for( i=2; i<15; i++)
{
switch( i )
{
@@ -1708,6 +1726,17 @@ void SaveConfigMailBox(int nConfigPage)
case 13:
strncpy(maildb[nConfigPage].inbox,szInfo[i],63);
break;
+ case 14:
+ maildb[nConfigPage].ssl=atoi (
szInfo[i] );
+ if ( maildb[nConfigPage].ssl < 0 )
+ {
+ maildb[nConfigPage].ssl = 0;
+ }
+ if ( maildb[nConfigPage].ssl > 1 )
+ {
+ maildb[nConfigPage].ssl = 1;
+ }
+ break;
}
}
}
@@ -3730,7 +3759,7 @@ void SaveAndReloadDB(int iSave)
void plugin_exec(PluginParam *par)
{
- char cvs_revision[] = "$Revision: 1.56 $";
+ char cvs_revision[] = "$Revision: 1.56A $";
int loop, account, mailindex;
FILE *fd_run;
FT_Error error;
@@ -3738,7 +3767,7 @@ void plugin_exec(PluginParam *par)
// show versioninfo
sscanf(cvs_revision, "%*s %s", versioninfo_p);
- printf("TuxMail %s\n", versioninfo_p);
+ printf("TuxMail (with SSL support) %s\n", versioninfo_p);
// get params
@@ -4273,7 +4302,7 @@ void plugin_exec(PluginParam *par)
{
fclose(fopen(RUNFILE, "w"));
#ifdef OE
- symlink("../init.d/tuxmail", OE_START);
+ symlink("../init.d/tuxmail",
OE_START);
symlink("../init.d/tuxmail",
OE_KILL0);
symlink("../init.d/tuxmail",
OE_KILL6);
#endif
diff --git a/tuxbox/plugins/tuxmail/tuxmail.conf
b/tuxbox/plugins/tuxmail/tuxmail.conf
index a0005aa..8010606 100644
--- a/tuxbox/plugins/tuxmail/tuxmail.conf
+++ b/tuxbox/plugins/tuxmail/tuxmail.conf
@@ -39,3 +39,4 @@ AUTH0=
SUSER0=
SPASS0=
INBOX0=
+SSL0=
diff --git a/tuxbox/plugins/tuxmail/tuxmail.h b/tuxbox/plugins/tuxmail/tuxmail.h
index e823011..14a3e80 100644
--- a/tuxbox/plugins/tuxmail/tuxmail.h
+++ b/tuxbox/plugins/tuxmail/tuxmail.h
@@ -370,6 +370,7 @@ struct
char suser[64];
char spass[64];
char inbox[64];
+ int ssl;
struct mi mailinfo[MAXMAIL];
}maildb[10];
commit 8e0aa4c0b9a0cb55c6b5da795cf2cb66414ab811
Author: GetAway <get-a...@t-online.de>
Date: Sat Aug 30 23:02:51 2014 +0200
tuxwetter: Unwetterwarnung updated
Signed-off-by: GetAway <get-a...@t-online.de>
Signed-off-by: Thilo Graf <d...@novatux.de>
diff --git a/tuxbox/plugins/tuxwetter/tuxwetter.conf
b/tuxbox/plugins/tuxwetter/tuxwetter.conf
index b8e1b51..eb79d92 100644
--- a/tuxbox/plugins/tuxwetter/tuxwetter.conf
+++ b/tuxbox/plugins/tuxwetter/tuxwetter.conf
@@ -64,18 +64,6 @@ MENU=New-Tuxwetter
PICTURE=48-Stunden-Vorhersage,http://image.de.weather.com/web/maps/de_DE/weather/forecast/germany_fcsthi_day2_720_de.jpg
PICTURE=72-Stunden-Vorhersage,http://image.de.weather.com/web/maps/de_DE/weather/forecast/germany_fcsthi_day3_720_de.jpg
ENDMENU
-# MENU=Unwetterwarnung Deutschland
-# PICTURE=DWD
Deutschland,http://www.wettergefahren.de/scripts/getimg.php?src=/wundk/Warnungen/DL00_O.png
-# PICTURE=Sturmwarnung
Deutschland,http://www.wettergefahren.de/scripts/getimg.php?src=/wundk/Warnungen/DL00_A.png
-# PICTURE=Nebelwarnung
Deutschland,http://www.wettergefahren.de/scripts/getimg.php?src=/wundk/Warnungen/DL00_J.png
-# PICTURE=Gewitterwarnung
Deutschland,http://www.wettergefahren.de/scripts/getimg.php?src=/wundk/Warnungen/DL00_E.png
-# PICTURE=Glättewarnung
Deutschland,http://www.wettergefahren.de/scripts/getimg.php?src=/wundk/Warnungen/DL00_G.png
-# PICTURE=Frostwarnung
Deutschland,http://www.wettergefahren.de/scripts/getimg.php?src=/wundk/Warnungen/DL00_I.png
-# PICTURE=Schnee
Deutschland,http://www.wettergefahren.de/scripts/getimg.php?src=/wundk/Warnungen/DL00_H.png
-# PICTURE=Tauwetter
Deutschland,http://www.wettergefahren.de/scripts/getimg.php?src=/wundk/Warnungen/DL00_D.png
-# TEXTPAGE=DWD Warnlage
Deutschland,http://www.wettergefahren.de/de/WundK/Warnungen/zeige.php?WL=DL00
-# TEXTPAGE=DWD
Wochenvorhersage,http://www.wettergefahren.de/de/WundK/Warnungen/zeige.php?WL=WVHS
-# ENDMENU
MENU=Regenradar
PICTURE=Regenradar
Deutschland,http://www.wetteronline.de/?pid=p_radar_map&ireq=true&src=radar/vermarktung/p_radar_map/wom/|YYYY/|MM/|DD/Intensity/DL/grey_flat/|YYYY|MM|DD|hh|N5m|R5mm_DL_Intensity.gif
PICTURE=Regenradar
Österreich,http://www.wetteronline.de/?pid=p_radar_map&ireq=true&src=radar/vermarktung/p_radar_map/wom/|YYYY/|MM/|DD/Intensity/OS/grey_flat/|YYYY|MM|DD|hh|N5m|R5mm_OS_Intensity.gif
@@ -597,6 +585,19 @@ MENU=New-Tuxwetter
PICTURE=UV-Index
Vorhersage,http://www.wettergefahren.de/wundk/medizin/uv_brd36.jpg
PICTURE=Seewetter
Vorhersage,http://www.wettergefahren.de/wundk/see/gme_fsee_na_p_24_000.png
ENDMENU
+ MENU=Unwetterwarnung
+ PICTURE=DWD
Europa,http://www.meteoalarm.eu/maps/EU-|YY|MM|DD.gif
+ PICTURE=DWD
Deutschland,http://www.meteoalarm.eu/maps/DE-|YY|MM|DD.gif
+ TXTHTML=DWD Warnlage
Deutschland,http://www.wettergefahren.de/dyn/app/ws/html/reports/DE_report_de.html|<div
id="ebp_ws_report_c_content">|</div>
+ TXTHTML=DWD
Wochenvorhersage,www.wettergefahren.de/app/ws/index.jsp?view=report&land_code=DE|Wochenvorhersage
Wettergefahren|<!-- #Portlet - END # -->
+ PICTURE=Sturmwarnung
Deutschland,http://www.meteoalarm.eu/maps/DE-|YY|MM|DD-t1.gif
+ PICTURE=Nebelwarnung
Deutschland,http://www.meteoalarm.eu/maps/DE-|YY|MM|DD-t4.gif
+ PICTURE=Gewitterwarnung
Deutschland,http://www.meteoalarm.eu/maps/DE-|YY|MM|DD-t3.gif
+ PICTURE=Schnee-/Eiswarnung
Deutschland,http://www.meteoalarm.eu/maps/DE-|YY|MM|DD-t2.gif
+ PICTURE=Regenwarnung
Deutschland,http://www.meteoalarm.eu/maps/DE-|YY|MM|DD-t10.gif
+ PICTURE=Extrem hohe
Temperaturen,http://www.meteoalarm.eu/maps/DE-|YY|MM|DD-t5.gif
+ PICTURE=Extrem niedrige
Temperaturen,http://www.meteoalarm.eu/maps/DE-|YY|MM|DD-t6.gif
+ ENDMENU
ENDMENU
MENU=Verkehrszustand
PICTURE=Stauwarnung
Süddeutschland,|GIF|http://www.swr3.de/info/verkehr/verkehr_images.php?img=M17
commit 703d44902bdd72a8490aaf90c765997992d87767
Author: GetAway <get-a...@t-online.de>
Date: Sat Aug 30 15:31:54 2014 +0200
tuxwetter: fix wrong parsing version bump 3.68
Signed-off-by: GetAway <get-a...@t-online.de>
Signed-off-by: Thilo Graf <d...@novatux.de>
diff --git a/tuxbox/plugins/tuxwetter/php.c b/tuxbox/plugins/tuxwetter/php.c
index edfcce2..f950967 100644
--- a/tuxbox/plugins/tuxwetter/php.c
+++ b/tuxbox/plugins/tuxwetter/php.c
@@ -98,14 +98,14 @@ FILE *fh;
cc=' ';
switch (*tptr)
{
- case
'a':
-
if((tptr=strchr(tptr+1,'m'))!=NULL) {
+ case
'a':
+
if (strncmp(tptr,"amp;",4)==0) {
cc='&';
}
else {
cc='ä';
}
-
break;
+
break;
case
'A': cc='Ä'; break;
case
'o': cc='ö'; break;
case
'O': cc='Ö'; break;
diff --git a/tuxbox/plugins/tuxwetter/tuxwetter.c
b/tuxbox/plugins/tuxwetter/tuxwetter.c
index f1903b5..3634ac1 100644
--- a/tuxbox/plugins/tuxwetter/tuxwetter.c
+++ b/tuxbox/plugins/tuxwetter/tuxwetter.c
@@ -43,7 +43,7 @@
#include "lcd.h"
#include "color.h"
-#define P_VERSION 3.66
+#define P_VERSION 3.68
#define S_VERSION ""
const char CONVERT_LIST[]="/var/tuxbox/config/tuxwetter/convert.list";
commit 43294adfaa570486a5dd118ffa3d55569e47bcf6
Author: GetAway <get-a...@t-online.de>
Date: Sat Aug 23 19:24:17 2014 +0200
cleanup some code fix some warnings
Signed-off-by: GetAway <get-a...@t-online.de>
Signed-off-by: Thilo Graf <d...@novatux.de>
diff --git a/tuxbox/plugins/tuxwetter/gif.c b/tuxbox/plugins/tuxwetter/gif.c
index 81557c6..508966d 100644
--- a/tuxbox/plugins/tuxwetter/gif.c
+++ b/tuxbox/plugins/tuxwetter/gif.c
@@ -68,15 +68,13 @@ inline void m_rend_gif_decodecolormap(unsigned char
*cmb,unsigned char *rgbb,Col
int fh_gif_load(const char *name,unsigned char *buffer,int x,int y)
{
int err = 0;
- int px,py,i,fby,fbx,fbl,ibxs;
- int eheight,j;
+ int px,py,i,j,ibxs;
unsigned char *fbptr;
unsigned char *lb;
unsigned char *slb;
GifFileType *gft;
GifByteType *extension;
int extcode;
- int spid;
GifRecordType rt;
ColorMapObject *cmap;
int cmaps;
@@ -144,18 +142,11 @@ int fh_gif_load(const char *name,unsigned char
*buffer,int x,int y)
int fh_gif_getsize(const char *name,int *x,int *y, int wanted_width, int
wanted_height)
{
int err = 0;
- int px,py,i,fby,fbx,fbl,ibxs;
- int eheight,j;
- char *fbptr;
- char *lb;
- char *slb;
+ int px,py;
GifFileType *gft;
GifByteType *extension;
int extcode;
- int spid;
GifRecordType rt;
- ColorMapObject *cmap;
- int cmaps;
gft=DGifOpenFileName(name, &err);
if(gft==NULL) gflush;
diff --git a/tuxbox/plugins/tuxwetter/gifdecomp.c
b/tuxbox/plugins/tuxwetter/gifdecomp.c
index fa861ac..ae51596 100644
--- a/tuxbox/plugins/tuxwetter/gifdecomp.c
+++ b/tuxbox/plugins/tuxwetter/gifdecomp.c
@@ -50,7 +50,6 @@
printfe("%s " format, __func__, ## __VA_ARGS__)
static int
- ImageNum = 0,
InterlacedFlag = FALSE,
InterlacedOffset[] = { 0, 4, 2, 1 }, /* The way Interlaced image should. */
InterlacedJumps[] = { 8, 8, 4, 2 }; /* be read - offsets and jumps... */
diff --git a/tuxbox/plugins/tuxwetter/tuxwetter.c
b/tuxbox/plugins/tuxwetter/tuxwetter.c
index 6ae641a..f1903b5 100644
--- a/tuxbox/plugins/tuxwetter/tuxwetter.c
+++ b/tuxbox/plugins/tuxwetter/tuxwetter.c
@@ -145,10 +145,10 @@ char city_code[30] = "";
char city_name[50] = "";
unsigned int alpha=0x0202;
int show_splash=1;
-unsigned char lastpicture[BUFSIZE]="";
-unsigned char nstr[BUFSIZE]="";
-unsigned char *trstr;
-unsigned char *htmstr;
+char lastpicture[BUFSIZE]="";
+char nstr[BUFSIZE]="";
+char *trstr;
+char *htmstr;
unsigned char *proxyadress=NULL, *proxyuserpwd=NULL;
const char INST_FILE[]="/tmp/rc.locked";
const char LCDL_FILE[]="/tmp/lcd.locked";
@@ -2277,7 +2277,7 @@ int show_gif(char *name, int xstart, int ystart, int
xsize, int ysize, int wait,
FILE *tfh;
int x1,y1,rcg,count,cloop,rv=-1;
int imx,imy,dxo,dyo,dxp,dyp;
-unsigned char *buffer=NULL, fname[512];
+char *buffer=NULL, fname[512];
if((tfh=fopen(name,"r"))!=NULL)
{
commit bf71299a4d1a9939273cbd178dc7a2b6c1d9cee2
Author: FlatTV <fla...@gmx.de>
Date: Sat Aug 23 18:43:11 2014 +0200
use curl for localhost
Signed-off-by: GetAway <get-a...@t-online.de>
Signed-off-by: Thilo Graf <d...@novatux.de>
diff --git a/tuxbox/plugins/tuxwetter/http.c b/tuxbox/plugins/tuxwetter/http.c
index ac03020..731b2e4 100644
--- a/tuxbox/plugins/tuxwetter/http.c
+++ b/tuxbox/plugins/tuxwetter/http.c
@@ -49,8 +49,10 @@ int HTTP_downloadFile(char *URL, char *downloadTarget, int
showprogress, int tmo
{
CURL *curl;
CURLcode res=-1;
- char *pt1,*pt2,*pt3=NULL,*tstr=NULL,*surl=URL,myself[25];
- FILE *headerfile,*netfile;
+ //char *pt1,*pt2,*pt3=NULL,myself[25];
+ char *tstr=NULL,*surl=URL;
+ FILE *headerfile;
+ //FILE *netfile;
int i=strlen(URL),y;
for(y=0; y<4; y++) // change HTTP to lower case
@@ -70,7 +72,7 @@ int HTTP_downloadFile(char *URL, char *downloadTarget, int
showprogress, int tmo
curl = curl_easy_init();
if(curl)
{
- pt1=strstr(URL,"localhost");
+/* pt1=strstr(URL,"localhost");
if(!pt1)
{
pt1=strstr(URL,"127.0.0.1");
@@ -104,7 +106,7 @@ int HTTP_downloadFile(char *URL, char *downloadTarget, int
showprogress, int tmo
}
}
}
- speed=tmo;
+*/ speed=tmo;
while(res && repeats--)
{
curl_easy_setopt(curl, CURLOPT_URL, surl);
@@ -117,6 +119,7 @@ int HTTP_downloadFile(char *URL, char *downloadTarget, int
showprogress, int tmo
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT,
(ctimo)?ctimo:(30+tmo*45));
curl_easy_setopt(curl, CURLOPT_TIMEOUT, (tmo+1)*60);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 0);
+ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
if(proxyadress && strstr(URL,"//127.0.0.1/")==NULL &&
strstr(URL,"//localhost/")==NULL)
{
curl_easy_setopt(curl, CURLOPT_PROXY,
proxyadress);
@@ -124,7 +127,7 @@ int HTTP_downloadFile(char *URL, char *downloadTarget, int
showprogress, int tmo
}
else
{
- curl_easy_setopt(curl, CURLOPT_PROXY, 0);
+ curl_easy_setopt(curl, CURLOPT_PROXY, NULL);
}
if(proxyuserpwd && strstr(URL,"//127.0.0.1/")==NULL &&
strstr(URL,"//localhost/")==NULL)
{
commit 11f4071bcc45888c9edad68b3bf0a9e84ea0359d
Author: GetAway <get-a...@t-online.de>
Date: Sat Aug 23 18:31:04 2014 +0200
change HTTP to lower case
Signed-off-by: GetAway <get-a...@t-online.de>
Signed-off-by: Thilo Graf <d...@novatux.de>
diff --git a/tuxbox/plugins/tuxwetter/http.c b/tuxbox/plugins/tuxwetter/http.c
index 22f5144..ac03020 100644
--- a/tuxbox/plugins/tuxwetter/http.c
+++ b/tuxbox/plugins/tuxwetter/http.c
@@ -51,15 +51,19 @@ int HTTP_downloadFile(char *URL, char *downloadTarget, int
showprogress, int tmo
CURLcode res=-1;
char *pt1,*pt2,*pt3=NULL,*tstr=NULL,*surl=URL,myself[25];
FILE *headerfile,*netfile;
- int i=strlen(URL);
+ int i=strlen(URL),y;
+
+ for(y=0; y<4; y++) // change HTTP to lower case
+ URL[y]=tolower(URL[y]);
+
while(i)
+ {
+ if(URL[i] <= ' ')
{
- if(URL[i] <= ' ')
- {
- URL[i]=0;
- }
- --i;
+ URL[i]=0;
}
+ --i;
+ }
headerfile = fopen(downloadTarget, "w");
if (!headerfile)
return res;
commit c91f0f579924a2cce9d74f87fadbdf411e2d1aeb
Author: GetAway <get-a...@t-online.de>
Date: Sat Aug 23 09:58:00 2014 +0200
Removed obsolete libungif - switched to giflib-5.1.0
Ported some code of tuxwetter and enigma
Signed-off-by: GetAway <get-a...@t-online.de>
Signed-off-by: Thilo Graf <d...@novatux.de>
diff --git a/tuxbox/enigma/lib/picviewer/gif.cpp
b/tuxbox/enigma/lib/picviewer/gif.cpp
index 761eb69..5591348 100644
--- a/tuxbox/enigma/lib/picviewer/gif.cpp
+++ b/tuxbox/enigma/lib/picviewer/gif.cpp
@@ -13,10 +13,10 @@ extern "C" {
#include <signal.h>
#define min(a,b) ((a) < (b) ? (a) : (b))
#define gflush return(FH_ERROR_FILE);
-#define grflush {DGifCloseFile(gft); return(FH_ERROR_FORMAT);}
-#define mgrflush {free(lb); free(slb); DGifCloseFile(gft);
return(FH_ERROR_FORMAT);}
+#define grflush {DGifCloseFile(gft, &err); return(FH_ERROR_FORMAT);}
+#define mgrflush {free(lb); free(slb); DGifCloseFile(gft, &err);
return(FH_ERROR_FORMAT);}
#define agflush return(FH_ERROR_FORMAT);
-#define agrflush {DGifCloseFile(gft); return(FH_ERROR_FORMAT);}
+#define agrflush {DGifCloseFile(gft, &err); return(FH_ERROR_FORMAT);}
int fh_gif_id(const char *name)
{
@@ -46,6 +46,7 @@ inline void m_rend_gif_decodecolormap(unsigned char *cmb,
unsigned char *rgbb, C
}
int fh_gif_load(const char *name, unsigned char *buffer, int x, int y)
{
+ int err = 0;
int px, py, i, ibxs;
int j;
unsigned char *fbptr;
@@ -58,7 +59,7 @@ int fh_gif_load(const char *name, unsigned char *buffer, int
x, int y)
ColorMapObject *cmap;
int cmaps;
- gft = DGifOpenFileName(name);
+ gft = DGifOpenFileName(name, &err);
if (gft == NULL)
gflush;
do
@@ -124,19 +125,20 @@ int fh_gif_load(const char *name, unsigned char *buffer,
int x, int y)
}
}
while (rt != TERMINATE_RECORD_TYPE);
- DGifCloseFile(gft);
+ DGifCloseFile(gft, &err);
return(FH_ERROR_OK);
}
int fh_gif_getsize(const char *name, int *x, int *y, int wanted_width, int
wanted_height)
{
+ int err = 0;
int px, py;
GifFileType *gft;
GifByteType *extension;
int extcode;
GifRecordType rt;
- gft = DGifOpenFileName(name);
+ gft = DGifOpenFileName(name, &err);
if (gft == NULL)
gflush;
do
@@ -151,7 +153,7 @@ int fh_gif_getsize(const char *name, int *x, int *y, int
wanted_width, int wante
px = gft->Image.Width;
py = gft->Image.Height;
*x = px; *y = py;
- DGifCloseFile(gft);
+ DGifCloseFile(gft, &err);
return(FH_ERROR_OK);
break;
case EXTENSION_RECORD_TYPE:
@@ -166,7 +168,7 @@ int fh_gif_getsize(const char *name, int *x, int *y, int
wanted_width, int wante
}
}
while (rt != TERMINATE_RECORD_TYPE);
- DGifCloseFile(gft);
+ DGifCloseFile(gft, &err);
return(FH_ERROR_FORMAT);
}
#endif
diff --git a/tuxbox/enigma/src/Makefile.am b/tuxbox/enigma/src/Makefile.am
index 926e429..28d3500 100644
--- a/tuxbox/enigma/src/Makefile.am
+++ b/tuxbox/enigma/src/Makefile.am
@@ -53,7 +53,7 @@ enigma_LDADD = \
@VORBISIDEC_LIBS@ \
@SQLITE_LIBS@ \
@FRIBIDI_LIBS@ \
- -ldl -lpthread -lcrypt -lresolv -ljpeg -lungif
+ -ldl -lpthread -lcrypt -lresolv -ljpeg -lgif
enigma$(EXEEXT): $(enigma_OBJECTS) $(enigma_DEPENDENCIES) $(enigma_LDADD_WHOLE)
@rm -f enigma$(EXEEXT)
diff --git a/tuxbox/plugins/tuxwetter/Makefile.am
b/tuxbox/plugins/tuxwetter/Makefile.am
index 3f4fc0b..71d2084 100644
--- a/tuxbox/plugins/tuxwetter/Makefile.am
+++ b/tuxbox/plugins/tuxwetter/Makefile.am
@@ -11,7 +11,7 @@ tuxwetter_LDADD = \
@CURL_LIBS@ \
@PNG_LIBS@ \
-ljpeg \
- -lungif
+ -lgif
bin_PROGRAMS = tuxwetter
diff --git a/tuxbox/plugins/tuxwetter/gif.c b/tuxbox/plugins/tuxwetter/gif.c
index 434ed0b..81557c6 100644
--- a/tuxbox/plugins/tuxwetter/gif.c
+++ b/tuxbox/plugins/tuxwetter/gif.c
@@ -37,10 +37,10 @@
#define FH_ERROR_MALLOC 3 /* error during malloc */
#define min(a,b) ((a) < (b) ? (a) : (b))
#define gflush return(FH_ERROR_FILE);
-#define grflush { DGifCloseFile(gft); return(FH_ERROR_FORMAT); }
-#define mgrflush { free(lb); free(slb); DGifCloseFile(gft);
return(FH_ERROR_FORMAT); }
+#define grflush { DGifCloseFile(gft, &err); return(FH_ERROR_FORMAT); }
+#define mgrflush { free(lb); free(slb); DGifCloseFile(gft, &err);
return(FH_ERROR_FORMAT); }
#define agflush return(FH_ERROR_FORMAT);
-#define agrflush { DGifCloseFile(gft); return(FH_ERROR_FORMAT); }
+#define agrflush { DGifCloseFile(gft, &err); return(FH_ERROR_FORMAT); }
int fh_gif_id(const char *name)
{
@@ -67,6 +67,7 @@ inline void m_rend_gif_decodecolormap(unsigned char
*cmb,unsigned char *rgbb,Col
}
int fh_gif_load(const char *name,unsigned char *buffer,int x,int y)
{
+ int err = 0;
int px,py,i,fby,fbx,fbl,ibxs;
int eheight,j;
unsigned char *fbptr;
@@ -80,7 +81,7 @@ int fh_gif_load(const char *name,unsigned char *buffer,int
x,int y)
ColorMapObject *cmap;
int cmaps;
- gft=DGifOpenFileName(name);
+ gft=DGifOpenFileName(name, &err);
if(gft==NULL) gflush;
do
{
@@ -137,11 +138,12 @@ int fh_gif_load(const char *name,unsigned char
*buffer,int x,int y)
}
}
while( rt!= TERMINATE_RECORD_TYPE );
- DGifCloseFile(gft);
+ DGifCloseFile(gft, &err);
return(FH_ERROR_OK);
}
int fh_gif_getsize(const char *name,int *x,int *y, int wanted_width, int
wanted_height)
{
+ int err = 0;
int px,py,i,fby,fbx,fbl,ibxs;
int eheight,j;
char *fbptr;
@@ -155,7 +157,7 @@ int fh_gif_getsize(const char *name,int *x,int *y, int
wanted_width, int wanted_
ColorMapObject *cmap;
int cmaps;
- gft=DGifOpenFileName(name);
+ gft=DGifOpenFileName(name, &err);
if(gft==NULL) gflush;
do
{
@@ -168,7 +170,7 @@ int fh_gif_getsize(const char *name,int *x,int *y, int
wanted_width, int wanted_
px=gft->Image.Width;
py=gft->Image.Height;
*x=px; *y=py;
- DGifCloseFile(gft);
+ DGifCloseFile(gft, &err);
return(FH_ERROR_OK);
break;
case EXTENSION_RECORD_TYPE:
@@ -181,6 +183,6 @@ int fh_gif_getsize(const char *name,int *x,int *y, int
wanted_width, int wanted_
}
}
while( rt!= TERMINATE_RECORD_TYPE );
- DGifCloseFile(gft);
+ DGifCloseFile(gft, &err);
return(FH_ERROR_FORMAT);
}
diff --git a/tuxbox/plugins/tuxwetter/gif_lib.h
b/tuxbox/plugins/tuxwetter/gif_lib.h
deleted file mode 100644
index 96c6cca..0000000
--- a/tuxbox/plugins/tuxwetter/gif_lib.h
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * $Id: gif_lib.h,v 1.1 2009/12/19 19:42:49 rhabarber1848 Exp $
- *
- * tuxwetter - d-box2 linux project
- *
- * This program 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
-*/
-
-/******************************************************************************
- * In order to make life a little bit easier when using the GIF file format,
- * this library was written, and which does all the dirty work...
- *
- * Written by Gershon Elber, Jun. 1989
- * Hacks by Eric S. Raymond, Sep. 1992
- ******************************************************************************
- * History:
- * 14 Jun 89 - Version 1.0 by Gershon Elber.
- * 3 Sep 90 - Version 1.1 by Gershon Elber (Support for Gif89, Unique names)
- * 15 Sep 90 - Version 2.0 by Eric S. Raymond (Changes to suoport GIF slurp)
- * 26 Jun 96 - Version 3.0 by Eric S. Raymond (Full GIF89 support)
- * 17 Dec 98 - Version 4.0 by Toshio Kuratomi (Fix extension writing code)
- *****************************************************************************/
-
-#ifndef _GIF_LIB_H_
-#define _GIF_LIB_H_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define GIF_LIB_VERSION " Version 4.1, "
-
-#define GIF_ERROR 0
-#define GIF_OK 1
-
-#ifndef TRUE
-#define TRUE 1
-#endif /* TRUE */
-#ifndef FALSE
-#define FALSE 0
-#endif /* FALSE */
-
-#ifndef NULL
-#define NULL 0
-#endif /* NULL */
-
-#define GIF_STAMP "GIFVER" /* First chars in file - GIF stamp. */
-#define GIF_STAMP_LEN sizeof(GIF_STAMP) - 1
-#define GIF_VERSION_POS 3 /* Version first character in stamp. */
-#define GIF87_STAMP "GIF87a" /* First chars in file - GIF stamp. */
-#define GIF89_STAMP "GIF89a" /* First chars in file - GIF stamp. */
-
-#define GIF_FILE_BUFFER_SIZE 16384 /* Files uses bigger buffers than usual. */
-
-typedef int GifBooleanType;
-typedef unsigned char GifPixelType;
-typedef unsigned char *GifRowType;
-typedef unsigned char GifByteType;
-
-#define GIF_MESSAGE(Msg) fprintf(stderr, "\n%s: %s\n", PROGRAM_NAME, Msg)
-#define GIF_EXIT(Msg) { GIF_MESSAGE(Msg); exit(-3); }
-
-#ifdef SYSV
-#define VoidPtr char *
-#else
-#define VoidPtr void *
-#endif /* SYSV */
-
-typedef struct GifColorType {
- GifByteType Red, Green, Blue;
-} GifColorType;
-
-typedef struct ColorMapObject {
- int ColorCount;
- int BitsPerPixel;
- GifColorType *Colors; /* on malloc(3) heap */
-} ColorMapObject;
-
-typedef struct GifImageDesc {
- int Left, Top, Width, Height, /* Current image dimensions. */
- Interlace; /* Sequential/Interlaced lines. */
- ColorMapObject *ColorMap; /* The local color map */
-} GifImageDesc;
-
-typedef struct GifFileType {
- int SWidth, SHeight, /* Screen dimensions. */
- SColorResolution, /* How many colors can we generate? */
- SBackGroundColor; /* I hope you understand this one... */
- ColorMapObject *SColorMap; /* NULL if not exists. */
- int ImageCount; /* Number of current image */
- GifImageDesc Image; /* Block describing current image */
- struct SavedImage *SavedImages; /* Use this to accumulate file state */
- VoidPtr UserData; /* hook to attach user data (TVT) */
- VoidPtr Private; /* Don't mess with this! */
-} GifFileType;
-
-typedef enum {
- UNDEFINED_RECORD_TYPE,
- SCREEN_DESC_RECORD_TYPE,
- IMAGE_DESC_RECORD_TYPE, /* Begin with ',' */
- EXTENSION_RECORD_TYPE, /* Begin with '!' */
- TERMINATE_RECORD_TYPE /* Begin with ';' */
-} GifRecordType;
-
-/* DumpScreen2Gif routine constants identify type of window/screen to dump.
- * Note all values below 1000 are reserved for the IBMPC different display
- * devices (it has many!) and are compatible with the numbering TC2.0
- * (Turbo C 2.0 compiler for IBM PC) gives to these devices.
- */
-typedef enum {
- GIF_DUMP_SGI_WINDOW = 1000,
- GIF_DUMP_X_WINDOW = 1001
-} GifScreenDumpType;
-
-/* func type to read gif data from arbitrary sources (TVT) */
-typedef int (*InputFunc) (GifFileType *, GifByteType *, int);
-
-/* func type to write gif data ro arbitrary targets.
- * Returns count of bytes written. (MRB)
- */
-typedef int (*OutputFunc) (GifFileType *, const GifByteType *, int);
-
-/******************************************************************************
- * GIF89 extension function codes
-******************************************************************************/
-
-#define COMMENT_EXT_FUNC_CODE 0xfe /* comment */
-#define GRAPHICS_EXT_FUNC_CODE 0xf9 /* graphics control */
-#define PLAINTEXT_EXT_FUNC_CODE 0x01 /* plaintext */
-#define APPLICATION_EXT_FUNC_CODE 0xff /* application block */
-
-/******************************************************************************
- * O.K., here are the routines one can access in order to encode GIF file:
- * (GIF_LIB file EGIF_LIB.C).
-******************************************************************************/
-
-GifFileType *EGifOpenFileName(const char *GifFileName,
- int GifTestExistance);
-GifFileType *EGifOpenFileHandle(int GifFileHandle);
-GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc);
-
-int EGifSpew(GifFileType * GifFile);
-void EGifSetGifVersion(const char *Version);
-int EGifPutScreenDesc(GifFileType * GifFile,
- int GifWidth, int GifHeight, int GifColorRes,
- int GifBackGround,
- const ColorMapObject * GifColorMap);
-int EGifPutImageDesc(GifFileType * GifFile, int GifLeft, int GifTop,
- int Width, int GifHeight, int GifInterlace,
- const ColorMapObject * GifColorMap);
-int EGifPutLine(GifFileType * GifFile, GifPixelType * GifLine,
- int GifLineLen);
-int EGifPutPixel(GifFileType * GifFile, GifPixelType GifPixel);
-int EGifPutComment(GifFileType * GifFile, const char *GifComment);
-int EGifPutExtensionFirst(GifFileType * GifFile, int GifExtCode,
- int GifExtLen, const VoidPtr GifExtension);
-int EGifPutExtensionNext(GifFileType * GifFile, int GifExtCode,
- int GifExtLen, const VoidPtr GifExtension);
-int EGifPutExtensionLast(GifFileType * GifFile, int GifExtCode,
- int GifExtLen, const VoidPtr GifExtension);
-int EGifPutExtension(GifFileType * GifFile, int GifExtCode, int GifExtLen,
- const VoidPtr GifExtension);
-int EGifPutCode(GifFileType * GifFile, int GifCodeSize,
- const GifByteType * GifCodeBlock);
-int EGifPutCodeNext(GifFileType * GifFile,
- const GifByteType * GifCodeBlock);
-int EGifCloseFile(GifFileType * GifFile);
-
-#define E_GIF_ERR_OPEN_FAILED 1 /* And EGif possible errors. */
-#define E_GIF_ERR_WRITE_FAILED 2
-#define E_GIF_ERR_HAS_SCRN_DSCR 3
-#define E_GIF_ERR_HAS_IMAG_DSCR 4
-#define E_GIF_ERR_NO_COLOR_MAP 5
-#define E_GIF_ERR_DATA_TOO_BIG 6
-#define E_GIF_ERR_NOT_ENOUGH_MEM 7
-#define E_GIF_ERR_DISK_IS_FULL 8
-#define E_GIF_ERR_CLOSE_FAILED 9
-#define E_GIF_ERR_NOT_WRITEABLE 10
-
-/******************************************************************************
- * O.K., here are the routines one can access in order to decode GIF file:
- * (GIF_LIB file DGIF_LIB.C).
- *****************************************************************************/
-
-GifFileType *DGifOpenFileName(const char *GifFileName);
-GifFileType *DGifOpenFileHandle(int GifFileHandle);
-GifFileType *DGifOpen(void *userPtr, InputFunc readFunc); /* new one
- * (TVT) */
-int DGifSlurp(GifFileType * GifFile);
-int DGifGetScreenDesc(GifFileType * GifFile);
-int DGifGetRecordType(GifFileType * GifFile, GifRecordType * GifType);
-int DGifGetImageDesc(GifFileType * GifFile);
-int DGifGetLine(GifFileType * GifFile, GifPixelType * GifLine, int GifLineLen);
-int DGifGetPixel(GifFileType * GifFile, GifPixelType GifPixel);
-int DGifGetComment(GifFileType * GifFile, char *GifComment);
-int DGifGetExtension(GifFileType * GifFile, int *GifExtCode,
- GifByteType ** GifExtension);
-int DGifGetExtensionNext(GifFileType * GifFile, GifByteType ** GifExtension);
-int DGifGetCode(GifFileType * GifFile, int *GifCodeSize,
- GifByteType ** GifCodeBlock);
-int DGifGetCodeNext(GifFileType * GifFile, GifByteType ** GifCodeBlock);
-int DGifGetLZCodes(GifFileType * GifFile, int *GifCode);
-int DGifCloseFile(GifFileType * GifFile);
-
-#define D_GIF_ERR_OPEN_FAILED 101 /* And DGif possible errors. */
-#define D_GIF_ERR_READ_FAILED 102
-#define D_GIF_ERR_NOT_GIF_FILE 103
-#define D_GIF_ERR_NO_SCRN_DSCR 104
-#define D_GIF_ERR_NO_IMAG_DSCR 105
-#define D_GIF_ERR_NO_COLOR_MAP 106
-#define D_GIF_ERR_WRONG_RECORD 107
-#define D_GIF_ERR_DATA_TOO_BIG 108
-#define D_GIF_ERR_NOT_ENOUGH_MEM 109
-#define D_GIF_ERR_CLOSE_FAILED 110
-#define D_GIF_ERR_NOT_READABLE 111
-#define D_GIF_ERR_IMAGE_DEFECT 112
-#define D_GIF_ERR_EOF_TOO_SOON 113
-
-/******************************************************************************
- * O.K., here are the routines from GIF_LIB file QUANTIZE.C.
-******************************************************************************/
-int QuantizeBuffer(unsigned int Width, unsigned int Height,
- int *ColorMapSize, GifByteType * RedInput,
- GifByteType * GreenInput, GifByteType * BlueInput,
- GifByteType * OutputBuffer,
- GifColorType * OutputColorMap);
-
-/******************************************************************************
- * O.K., here are the routines from GIF_LIB file QPRINTF.C.
-******************************************************************************/
-extern int GifQuietPrint;
-
-#ifdef HAVE_STDARG_H
- extern void GifQprintf(char *Format, ...);
-#elif defined (HAVE_VARARGS_H)
- extern void GifQprintf();
-#endif /* HAVE_STDARG_H */
-
-/******************************************************************************
- * O.K., here are the routines from GIF_LIB file GIF_ERR.C.
-******************************************************************************/
-extern void PrintGifError(void);
-extern int GifLastError(void);
-
-/******************************************************************************
- * O.K., here are the routines from GIF_LIB file DEV2GIF.C.
-******************************************************************************/
-extern int DumpScreen2Gif(const char *FileName,
- int ReqGraphDriver,
- long ReqGraphMode1,
- long ReqGraphMode2,
- long ReqGraphMode3);
-
-/*****************************************************************************
- *
- * Everything below this point is new after version 1.2, supporting `slurp
- * mode' for doing I/O in two big belts with all the image-bashing in core.
- *
- *****************************************************************************/
-
-/******************************************************************************
- * Color Map handling from ALLOCGIF.C
- *****************************************************************************/
-
-extern ColorMapObject *MakeMapObject(int ColorCount,
- const GifColorType * ColorMap);
-extern void FreeMapObject(ColorMapObject * Object);
-extern ColorMapObject *UnionColorMap(const ColorMapObject * ColorIn1,
- const ColorMapObject * ColorIn2,
- GifPixelType ColorTransIn2[]);
-extern int BitSize(int n);
-
-/******************************************************************************
- * Support for the in-core structures allocation (slurp mode).
- *****************************************************************************/
-
-/* This is the in-core version of an extension record */
-typedef struct {
- int ByteCount;
- char *Bytes; /* on malloc(3) heap */
- int Function; /* Holds the type of the Extension block. */
-} ExtensionBlock;
-
-/* This holds an image header, its unpacked raster bits, and extensions */
-typedef struct SavedImage {
- GifImageDesc ImageDesc;
- unsigned char *RasterBits; /* on malloc(3) heap */
- int Function; /* DEPRECATED: Use ExtensionBlocks[x].Function instead */
- int ExtensionBlockCount;
- ExtensionBlock *ExtensionBlocks; /* on malloc(3) heap */
-} SavedImage;
-
-extern void ApplyTranslation(SavedImage * Image, GifPixelType Translation[]);
-extern void MakeExtension(SavedImage * New, int Function);
-extern int AddExtensionBlock(SavedImage * New, int Len,
- unsigned char ExtData[]);
-extern void FreeExtension(SavedImage * Image);
-extern SavedImage *MakeSavedImage(GifFileType * GifFile,
- const SavedImage * CopyFrom);
-extern void FreeSavedImages(GifFileType * GifFile);
-
-/******************************************************************************
- * The library's internal utility font
- *****************************************************************************/
-
-#define GIF_FONT_WIDTH 8
-#define GIF_FONT_HEIGHT 8
-extern unsigned char AsciiTable[][GIF_FONT_WIDTH];
-
-extern void DrawText(SavedImage * Image,
- const int x, const int y,
- const char *legend, const int color);
-
-extern void DrawBox(SavedImage * Image,
- const int x, const int y,
- const int w, const int d, const int color);
-
-void DrawRectangle(SavedImage * Image,
- const int x, const int y,
- const int w, const int d, const int color);
-
-extern void DrawBoxedText(SavedImage * Image,
- const int x, const int y,
- const char *legend,
- const int border, const int bg, const int fg);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* _GIF_LIB_H */
diff --git a/tuxbox/plugins/tuxwetter/gifdecomp.c
b/tuxbox/plugins/tuxwetter/gifdecomp.c
index 4e81e18..fa861ac 100644
--- a/tuxbox/plugins/tuxwetter/gifdecomp.c
+++ b/tuxbox/plugins/tuxwetter/gifdecomp.c
@@ -25,14 +25,30 @@
#include <unistd.h>
#include <ctype.h>
#include <string.h>
-#include "gif_lib.h"
+#include <gif_lib.h>
#include "gifdecomp.h"
+#ifndef TRUE
+#define TRUE 1
+#endif /* TRUE */
+#ifndef FALSE
+#define FALSE 0
+#endif /* FALSE */
+
#define PROGRAM_NAME "GifDecomp"
#define GIF_ASM_NAME "Tuxwetter"
#define COMMENT_GIF_ASM "New-Tuxwetter-Team"
#define SQR(x) ((x) * (x))
+#define GIF_MESSAGE(Msg) fprintf(stderr, "\n%s: %s\n", PROGRAM_NAME, Msg)
+#define GIF_EXIT(Msg) { GIF_MESSAGE(Msg); exit(-3); }
+
+#define printfe(format, ...) \
+ (fprintf(stderr, format "\n", ## __VA_ARGS__), fflush(stderr))
+
+#define printfef(format, ...) \
+ printfe("%s " format, __func__, ## __VA_ARGS__)
+
static int
ImageNum = 0,
InterlacedFlag = FALSE,
@@ -50,7 +66,7 @@ void xremove(char *fname);
******************************************************************************/
int gifdecomp(char *InFileName, char *OutFileName)
{
-int i;
+int i, err = 0;
GifRowType *ImageBuffer;
char TempGifName[80];
@@ -70,30 +86,30 @@ int i;
/* Open input file: */
if (InFileName != NULL)
{
- if ((GifFileIn = DGifOpenFileName(InFileName)) == NULL)
- QuitGifError(GifFileIn, GifFileOut);
+ if ((GifFileIn = DGifOpenFileName(InFileName, &err)) == NULL)
+ QuitGifError(GifFileIn, GifFileOut, err);
}
- if ((GifFileIn = DGifOpenFileName(InFileName)) != NULL)
+ if ((GifFileIn = DGifOpenFileName(InFileName, &err)) != NULL)
{
- if ((GifFileOut = EGifOpenFileName(TempGifName, TRUE)) == NULL)
- QuitGifError(GifFileIn, GifFileOut);
+ if ((GifFileOut = EGifOpenFileName(TempGifName, TRUE, &err)) ==
NULL)
+ QuitGifError(GifFileIn, GifFileOut, err);
if (EGifPutScreenDesc(GifFileOut,
GifFileIn->SWidth, GifFileIn->SHeight,
GifFileIn->SColorResolution, GifFileIn->SBackGroundColor,
GifFileIn->SColorMap) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
/* Scan the content of the GIF file and load the image(s) in: */
do {
if (DGifGetRecordType(GifFileIn, &RecordType) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
switch (RecordType) {
case IMAGE_DESC_RECORD_TYPE:
if (DGifGetImageDesc(GifFileIn) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
/* Put the image descriptor to out file: */
if (EGifPutImageDesc(GifFileOut,
@@ -101,27 +117,27 @@ int i;
GifFileIn->Image.Width, GifFileIn->Image.Height,
InterlacedFlag,
GifFileIn->Image.ColorMap) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
/* Load the image (either Interlaced or not), and dump
it as */
/* defined in GifFileOut->Image.Interlaced.
*/
if (LoadImage(GifFileIn, &ImageBuffer) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
if (DumpImage(GifFileOut, ImageBuffer) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
break;
case EXTENSION_RECORD_TYPE:
/* Skip any extension blocks in file: */
if (DGifGetExtension(GifFileIn, &ExtCode, &Extension)
== GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
if (EGifPutExtension(GifFileOut, ExtCode, Extension[0],
Extension) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
/* No support to more than one extension blocks, so
discard: */
while (Extension != NULL) {
if (DGifGetExtensionNext(GifFileIn, &Extension) ==
GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
}
break;
case TERMINATE_RECORD_TYPE:
@@ -132,20 +148,20 @@ int i;
}
while (RecordType != TERMINATE_RECORD_TYPE);
- if (DGifCloseFile(GifFileIn) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
- if (EGifCloseFile(GifFileOut) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ if (DGifCloseFile(GifFileIn, &err) == GIF_ERROR)
+ QuitGifError(GifFileIn, GifFileOut, err);
+ if (EGifCloseFile(GifFileOut, &err) == GIF_ERROR)
+ QuitGifError(GifFileIn, GifFileOut, err);
- if ((GifFileIn = DGifOpenFileName(TempGifName)) == NULL)
- QuitGifError(GifFileIn, GifFileOut);
+ if ((GifFileIn = DGifOpenFileName(TempGifName, &err)) == NULL)
+ QuitGifError(GifFileIn, GifFileOut, err);
/* Scan the content of GIF file and dump image(s) to seperate
file(s): */
do {
sprintf(CrntFileName, "%s%02d.gif", OutFileName, FileNum++);
- if ((GifFileOut = EGifOpenFileName(CrntFileName, TRUE)) == NULL)
- QuitGifError(GifFileIn, GifFileOut);
+ if ((GifFileOut = EGifOpenFileName(CrntFileName, TRUE, &err))
== NULL)
+ QuitGifError(GifFileIn, GifFileOut, err);
FileEmpty = TRUE;
/* And dump out its exactly same screen information: */
@@ -153,50 +169,50 @@ int i;
GifFileIn->SWidth, GifFileIn->SHeight,
GifFileIn->SColorResolution, GifFileIn->SBackGroundColor,
GifFileIn->SColorMap) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
do {
if (DGifGetRecordType(GifFileIn, &RecordType) ==
GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
switch (RecordType) {
case IMAGE_DESC_RECORD_TYPE:
FileEmpty = FALSE;
if (DGifGetImageDesc(GifFileIn) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
/* Put same image descriptor to out file: */
if (EGifPutImageDesc(GifFileOut,
GifFileIn->Image.Left, GifFileIn->Image.Top,
GifFileIn->Image.Width, GifFileIn->Image.Height,
GifFileIn->Image.Interlace,
GifFileIn->Image.ColorMap) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
/* Now read image itself in decoded form as we dont
*/
/* really care what is there, and this is much
faster. */
if (DGifGetCode(GifFileIn, &CodeSize, &CodeBlock) ==
GIF_ERROR
|| EGifPutCode(GifFileOut, CodeSize, CodeBlock) ==
GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
while (CodeBlock != NULL)
if (DGifGetCodeNext(GifFileIn, &CodeBlock) ==
GIF_ERROR ||
EGifPutCodeNext(GifFileOut, CodeBlock) ==
GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
break;
case EXTENSION_RECORD_TYPE:
FileEmpty = FALSE;
/* Skip any extension blocks in file: */
if (DGifGetExtension(GifFileIn, &ExtCode,
&Extension)
== GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
if (EGifPutExtension(GifFileOut, ExtCode,
Extension[0],
Extension) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
/* No support to more than one extension
blocks, discard.*/
while (Extension != NULL)
if (DGifGetExtensionNext(GifFileIn, &Extension)
== GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ QuitGifError(GifFileIn, GifFileOut, err);
break;
case TERMINATE_RECORD_TYPE:
break;
@@ -207,8 +223,8 @@ int i;
while (RecordType != IMAGE_DESC_RECORD_TYPE &&
RecordType != TERMINATE_RECORD_TYPE);
- if (EGifCloseFile(GifFileOut) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ if (EGifCloseFile(GifFileOut, &err) == GIF_ERROR)
+ QuitGifError(GifFileIn, GifFileOut, err);
if (FileEmpty) {
/* Might happen on last file - delete it if so: */
unlink(CrntFileName);
@@ -216,8 +232,8 @@ int i;
}
while (RecordType != TERMINATE_RECORD_TYPE);
- if (DGifCloseFile(GifFileIn) == GIF_ERROR)
- QuitGifError(GifFileIn, GifFileOut);
+ if (DGifCloseFile(GifFileIn, &err) == GIF_ERROR)
+ QuitGifError(GifFileIn, GifFileOut, err);
FileNum=FileNum-1;
}
return FileNum;
@@ -226,15 +242,18 @@ return FileNum;
/******************************************************************************
* Close both input and output file (if open), and exit.
*
******************************************************************************/
-void QuitGifError(GifFileType *GifFileIn, GifFileType *GifFileOut)
+void QuitGifError(GifFileType *GifFileIn, GifFileType *GifFileOut, int
ErrorCode)
{
- PrintGifError();
- if (GifFileIn != NULL) DGifCloseFile(GifFileIn);
- if (GifFileOut != NULL) EGifCloseFile(GifFileOut);
+// PrintGifError();
+ const char *errstr = NULL;
+ errstr = GifErrorString(ErrorCode);
+ printfef("Failed to open file: %d (%s)", ErrorCode, errstr);
+
+ if (GifFileIn != NULL) DGifCloseFile(GifFileIn, &ErrorCode);
+ if (GifFileOut != NULL) EGifCloseFile(GifFileOut, &ErrorCode);
// exit(EXIT_FAILURE);
}
-
int LoadImage(GifFileType *GifFile, GifRowType **ImageBufferPtr)
{
int Size, i, j, Count;
@@ -255,10 +274,11 @@ int LoadImage(GifFileType *GifFile, GifRowType
**ImageBufferPtr)
}
*ImageBufferPtr = ImageBuffer;
-
+/*
GifQprintf("\n%s: Image %d at (%d, %d) [%dx%d]: ",
PROGRAM_NAME, ++ImageNum, GifFile->Image.Left, GifFile->Image.Top,
GifFile->Image.Width, GifFile->Image.Height);
+*/
if (GifFile->Image.Interlace) {
/* Need to perform 4 passes on the images: */
for (Count = i = 0; i < 4; i++)
diff --git a/tuxbox/plugins/tuxwetter/gifdecomp.h
b/tuxbox/plugins/tuxwetter/gifdecomp.h
index edc4262..b327284 100644
--- a/tuxbox/plugins/tuxwetter/gifdecomp.h
+++ b/tuxbox/plugins/tuxwetter/gifdecomp.h
@@ -26,6 +26,6 @@
#define __GIFDECOMP_H__
int gifdecomp(char *InFileName, char *OutFileName);
-void QuitGifError(GifFileType *GifFileIn, GifFileType *GifFileOut);
+void QuitGifError(GifFileType *GifFileIn, GifFileType *GifFileOut, int
ErrorCode);
#endif
diff --git a/tuxbox/plugins/tuxwetter/tuxwetter.c
b/tuxbox/plugins/tuxwetter/tuxwetter.c
index ed61faa..6ae641a 100644
--- a/tuxbox/plugins/tuxwetter/tuxwetter.c
+++ b/tuxbox/plugins/tuxwetter/tuxwetter.c
@@ -43,7 +43,7 @@
#include "lcd.h"
#include "color.h"
-#define P_VERSION 3.65
+#define P_VERSION 3.66
#define S_VERSION ""
const char CONVERT_LIST[]="/var/tuxbox/config/tuxwetter/convert.list";
-----------------------------------------------------------------------
Summary of changes:
tuxbox/enigma/lib/picviewer/gif.cpp | 18 +-
tuxbox/enigma/src/Makefile.am | 2 +-
tuxbox/neutrino/src/gui/themes.cpp | 235 +++++++----------
tuxbox/neutrino/src/gui/themes.h | 5 +-
tuxbox/neutrino/src/neutrino.cpp | 107 +--------
tuxbox/plugins/tuxmail/daemon/Makefile.am | 2 +-
tuxbox/plugins/tuxmail/daemon/tuxmaild.c | 392 +++++++++++++++++++++++------
tuxbox/plugins/tuxmail/daemon/tuxmaild.h | 13 +
tuxbox/plugins/tuxmail/tuxmail.c | 45 +++-
tuxbox/plugins/tuxmail/tuxmail.conf | 1 +
tuxbox/plugins/tuxmail/tuxmail.h | 1 +
tuxbox/plugins/tuxwetter/Makefile.am | 2 +-
tuxbox/plugins/tuxwetter/gif.c | 31 +--
tuxbox/plugins/tuxwetter/gif_lib.h | 343 -------------------------
tuxbox/plugins/tuxwetter/gifdecomp.c | 107 +++++----
tuxbox/plugins/tuxwetter/gifdecomp.h | 2 +-
tuxbox/plugins/tuxwetter/http.c | 29 ++-
tuxbox/plugins/tuxwetter/php.c | 6 +-
tuxbox/plugins/tuxwetter/tuxwetter.c | 12 +-
tuxbox/plugins/tuxwetter/tuxwetter.conf | 25 +-
tuxbox/tools/input/input.c | 2 +-
tuxbox/tools/input/text.c | 48 ++++-
22 files changed, 650 insertions(+), 778 deletions(-)
delete mode 100644 tuxbox/plugins/tuxwetter/gif_lib.h
--
Tuxbox-GIT: apps
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Tuxbox-cvs-commits mailing list
Tuxbox-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tuxbox-cvs-commits