diff --git a/trunk/swarmtv/libswarmtv/filehandler/filehandler.c b/trunk/swarmtv/libswarmtv/filehandler/filehandler.c index 2ae268b..fec1c51 100644 --- a/trunk/swarmtv/libswarmtv/filehandler/filehandler.c +++ b/trunk/swarmtv/libswarmtv/filehandler/filehandler.c @@ -22,7 +22,11 @@ #include <stdlib.h> #include <string.h> +#ifdef __MINGW32__ +#include "../types.h" /* looks stupid! */ +#else #include "types.h" +#endif #include "regexp.h" #include "curlfile.h" #include "filehandler.h" diff --git a/trunk/swarmtv/libswarmtv/filehandler/nzb/findnzb.c b/trunk/swarmtv/libswarmtv/filehandler/nzb/findnzb.c index 37f8660..49ff892 100644 --- a/trunk/swarmtv/libswarmtv/filehandler/nzb/findnzb.c +++ b/trunk/swarmtv/libswarmtv/filehandler/nzb/findnzb.c @@ -27,7 +27,11 @@ #include <libxml/xpath.h> #include <libxml/xpathInternals.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "regexp.h" #include "curlfile.h" #include "logfile.h" diff --git a/trunk/swarmtv/libswarmtv/filehandler/nzb/nzbparse.c b/trunk/swarmtv/libswarmtv/filehandler/nzb/nzbparse.c index 567a558..bda3ef8 100644 --- a/trunk/swarmtv/libswarmtv/filehandler/nzb/nzbparse.c +++ b/trunk/swarmtv/libswarmtv/filehandler/nzb/nzbparse.c @@ -26,7 +26,11 @@ #include <libxml/xpath.h> #include <libxml/xpathInternals.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "regexp.h" #include "curlfile.h" #include "findnzb.h" diff --git a/trunk/swarmtv/libswarmtv/filehandler/torrent/findtorrent.c b/trunk/swarmtv/libswarmtv/filehandler/torrent/findtorrent.c index f2d239a..99bd61a 100644 --- a/trunk/swarmtv/libswarmtv/filehandler/torrent/findtorrent.c +++ b/trunk/swarmtv/libswarmtv/filehandler/torrent/findtorrent.c @@ -29,7 +29,11 @@ #include <libxml/xpath.h> #include <libxml/xpathInternals.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "regexp.h" #include "curlfile.h" #include "logfile.h" diff --git a/trunk/swarmtv/libswarmtv/filehandler/torrent/torrentparse.c b/trunk/swarmtv/libswarmtv/filehandler/torrent/torrentparse.c index 194f37a..501574a 100644 --- a/trunk/swarmtv/libswarmtv/filehandler/torrent/torrentparse.c +++ b/trunk/swarmtv/libswarmtv/filehandler/torrent/torrentparse.c @@ -25,7 +25,11 @@ #include <time.h> #include <sqlite3.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "curlfile.h" #include "tbl.h" #include "torrentparse.h" diff --git a/trunk/swarmtv/libswarmtv/filesystem.c b/trunk/swarmtv/libswarmtv/filesystem.c index 44be037..5ebeed5 100644 --- a/trunk/swarmtv/libswarmtv/filesystem.c +++ b/trunk/swarmtv/libswarmtv/filesystem.c @@ -73,16 +73,20 @@ void rsstcompletepath(const char *origpath, char **destpath) * and not check for 0 every step of the way */ - SHGetFolderPath(NULL, CSIDL_COMMON_DOCUMENTS, NULL, 0, homedir); +#ifdef UNICODE /* might need some UNICODE safety here !! */ - //LPSTR homefolder=NULL; - //int cw=lstrlenW(homefolder); - //int cc=WideCharToMultiByte(CP_ACP, 0, homefolder, cw, NULL, 0, NULL, NULL); + LPWSTR homefolder=NULL; + SHGetFolderPath(NULL, CSIDL_COMMON_DOCUMENTS, NULL, 0, homefolder); + int cw=lstrlenW(homefolder); + int cc=WideCharToMultiByte(CP_ACP, 0, homefolder, cw, NULL, 0, NULL, NULL); /* now we know how many chars */ - //cc=WideCharToMultiByte(CP_ACP, 0, homefolder, cw, homedir, cc, NULL, NULL); - //homedir[cc]='\0'; + cc=WideCharToMultiByte(CP_ACP, 0, homefolder, cw, homedir, cc, NULL, NULL); + homedir[cc]='\0'; //delete homefolder; #else + SHGetFolderPath(NULL, CSIDL_COMMON_DOCUMENTS, NULL, 0, homedir); +#endif +#else homedir = getenv("HOME"); #endif @@ -271,8 +275,15 @@ int rsstdiskusage(char *path, int *usage) } #else DWORD dwBytesPerSector, dwSectorsPerCluster, dwFreeClusters, dwTotalClusters; + #ifdef UNICODE + wchar_t *wexppath=NULL; + mbstowcs(wexppath, exppath, MAX_PATH); + rc = GetDiskFreeSpace(wexppath, &dwBytesPerSector, + &dwSectorsPerCluster, &dwFreeClusters, &dwTotalClusters); + #else rc = GetDiskFreeSpace(exppath, &dwBytesPerSector, &dwSectorsPerCluster, &dwFreeClusters, &dwTotalClusters); + #endif if (rc < 0){ retval = -1; } else { diff --git a/trunk/swarmtv/libswarmtv/libswarmtv.pro b/trunk/swarmtv/libswarmtv/libswarmtv.pro index 68c4812..96453ca 100644 --- a/trunk/swarmtv/libswarmtv/libswarmtv.pro +++ b/trunk/swarmtv/libswarmtv/libswarmtv.pro @@ -17,8 +17,11 @@ INCLUDEPATH += . \ filehandler/torrent \ filehandler/nzb CONFIG += dll link_pkgconfig -PKGCONFIG += xml2po dbus-1 sqlite3 - +PKGCONFIG += xml2po sqlite3 dbus-1 glib-2.0 dbus-glib-1 +LIBS += -lcurl -lpcre # -lesmtp +win32{ +LIBS += -lsqlite3 -lxml2 -lcurldll -liconv -lwsock32 +} target.path = /usr/local/lib/ headers.path = /usr/local/include/ INSTALLS += target headers diff --git a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/defaultrss.c b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/defaultrss.c index 22fb9d0..d828e8b 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/defaultrss.c +++ b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/defaultrss.c @@ -24,7 +24,11 @@ #include <time.h> #include <stdlib.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "logfile.h" #include "curlfile.h" #include "regexp.h" diff --git a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/disectdate.c b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/disectdate.c index 7f9d490..b4e0f53 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/disectdate.c +++ b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/disectdate.c @@ -24,7 +24,11 @@ #include <time.h> #include <sqlite3.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "logfile.h" #include "rssparse.h" #include "defaultrss.h" diff --git a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsscategory.c b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsscategory.c index 130c18f..81499f0 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsscategory.c +++ b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsscategory.c @@ -23,7 +23,11 @@ #include <time.h> #include <stdlib.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "logfile.h" #include "defaultrss.h" #include "regexp.h" diff --git a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsslink.c b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsslink.c index 57b3f0c..ab500a2 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsslink.c +++ b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsslink.c @@ -24,7 +24,11 @@ #include <unistd.h> #include <stdlib.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "logfile.h" #include "regexp.h" #include "filehandler/torrent/findtorrent.h" diff --git a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssparse.c b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssparse.c index e6c3c6b..c9e4a9f 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssparse.c +++ b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssparse.c @@ -30,7 +30,11 @@ #include <string.h> #include <time.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "logfile.h" #include "rssparse.h" diff --git a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsspubdate.c b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsspubdate.c index cd05695..b75e8bd 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsspubdate.c +++ b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsspubdate.c @@ -23,7 +23,11 @@ #include <time.h> #include <stdlib.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "logfile.h" #include "disectdate.h" #include "disectdescription.h" diff --git a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssseasonepisode.c b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssseasonepisode.c index 073ebd5..81b90ec 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssseasonepisode.c +++ b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssseasonepisode.c @@ -23,7 +23,11 @@ #include <time.h> #include <pcre.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "logfile.h" #include "defaultrss.h" #include "disectdescription.h" diff --git a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssseedspeers.c b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssseedspeers.c index 2aa41fd..4827ea8 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssseedspeers.c +++ b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rssseedspeers.c @@ -23,7 +23,11 @@ #include <time.h> #include <stdlib.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "logfile.h" #include "defaultrss.h" diff --git a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsssize.c b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsssize.c index 7dfad26..36332fe 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsssize.c +++ b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsssize.c @@ -25,7 +25,11 @@ #include <ctype.h> #include <math.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "logfile.h" #include "config.h" #include "regexp.h" diff --git a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsstitle.c b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsstitle.c index 1044068..bc549f0 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsstitle.c +++ b/trunk/swarmtv/libswarmtv/srcparser/defaultrss/rsstitle.c @@ -23,7 +23,11 @@ #include <string.h> #include <sqlite3.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "logfile.h" #include "regexp.h" #include "defaultrss.h" diff --git a/trunk/swarmtv/libswarmtv/srcparser/twitter/splittext.c b/trunk/swarmtv/libswarmtv/srcparser/twitter/splittext.c index 31f6e2d..a9962d3 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/twitter/splittext.c +++ b/trunk/swarmtv/libswarmtv/srcparser/twitter/splittext.c @@ -25,7 +25,11 @@ #include <pcre.h> #include <sqlite3.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "curlfile.h" #include "logfile.h" #include "twitparse.h" diff --git a/trunk/swarmtv/libswarmtv/srcparser/twitter/twitparse.c b/trunk/swarmtv/libswarmtv/srcparser/twitter/twitparse.c index 3653664..45706db 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/twitter/twitparse.c +++ b/trunk/swarmtv/libswarmtv/srcparser/twitter/twitparse.c @@ -27,7 +27,11 @@ #include <libxml/xpath.h> #include <libxml/xpathInternals.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "logfile.h" #include "curlfile.h" #include "twitparse.h" diff --git a/trunk/swarmtv/libswarmtv/srcparser/twitter/twitter.c b/trunk/swarmtv/libswarmtv/srcparser/twitter/twitter.c index 158c71b..e5e88d1 100644 --- a/trunk/swarmtv/libswarmtv/srcparser/twitter/twitter.c +++ b/trunk/swarmtv/libswarmtv/srcparser/twitter/twitter.c @@ -24,7 +24,11 @@ #include <sqlite3.h> #include <stdlib.h> +#ifdef __MINGW32__ +#include "../../types.h" /* looks damn ugly! */ +#else #include "types.h" +#endif #include "curlfile.h" #include "logfile.h" #include "twitparse.h" diff --git a/trunk/swarmtv/shellfront/daemonize.c b/trunk/swarmtv/shellfront/daemonize.c index fc3ec2f..e052cd5 100644 --- a/trunk/swarmtv/shellfront/daemonize.c +++ b/trunk/swarmtv/shellfront/daemonize.c @@ -28,12 +28,16 @@ #include "filesystem.h" #include "sqlite3.h" -#include "types.h" +#ifdef __MINGW32__ +#include "../libswarmtv/types.h" +#else +#include "types.h". +#endif #include "config.h" #ifdef __MINGW32__ #include <windows.h> -/* TODO get 'good' Windows CreateProcess stuff going on */ +/* TODO get 'good' Windows CreateProcess stuff going on? */ #define getppid() 0 #define fork() 0 #define setsid() 0 diff --git a/trunk/swarmtv/shellfront/mailmsg.c b/trunk/swarmtv/shellfront/mailmsg.c index 41c2e2e..26e5ab0 100644 --- a/trunk/swarmtv/shellfront/mailmsg.c +++ b/trunk/swarmtv/shellfront/mailmsg.c @@ -35,7 +35,11 @@ #include <libesmtp.h> #include <sqlite3.h> -#include "types.h" +#ifdef __MINGW32__ +#include "../libswarmtv/types.h" +#else +#include "types.h". +#endif #include "config.h" #include "logfile.h" @@ -147,7 +151,9 @@ static int rsstsendrssmail(sqlite3 *db, const char *subject, const char *msgtxt) */ static int rsstsendmail(const char *host, const char *from, const char *to, const char *subject, const char *msgtxt) { - int retval=0; + int retval=0; + /* no mail on windows ATM! */ +#ifndef __MINGW32__ smtp_session_t session; smtp_message_t message; smtp_recipient_t recipient; @@ -252,6 +258,7 @@ static int rsstsendmail(const char *host, const char *from, const char *to, cons //auth_destroy_context (authctx); //fclose (fp); auth_client_exit (); +#endif //exit (0); return retval; } diff --git a/trunk/swarmtv/shellfront/shellfront.pro b/trunk/swarmtv/shellfront/shellfront.pro index 36411e5..3c68597 100644 --- a/trunk/swarmtv/shellfront/shellfront.pro +++ b/trunk/swarmtv/shellfront/shellfront.pro @@ -8,9 +8,12 @@ DEPENDPATH += . INCLUDEPATH += . ../libswarmtv CONFIG += link_pkgconfig PKGCONFIG += xml2po dbus-1 glib-2.0 dbus-glib-1 sqlite3 -LIBS += -L../libswarmtv -lswarmtv -lcurl +LIBS += -L../libswarmtv -lswarmtv -lcurl -lpcre unix{ -LIBS += -lesmtp + LIBS += -lesmtp +} +win32{ +LIBS += -lxml2 -ldbus-1 -lglib-2.0 -ldbus-glib-1 -lwsock32 -lws2_32 -liconv } target.path = /usr/local/bin/ INSTALLS += target diff --git a/trunk/swarmtv/shellfront/swarmtv.c b/trunk/swarmtv/shellfront/swarmtv.c index 1d436d1..bea3c24 100644 --- a/trunk/swarmtv/shellfront/swarmtv.c +++ b/trunk/swarmtv/shellfront/swarmtv.c @@ -26,7 +26,11 @@ #include <libxml/parser.h> #include <signal.h> -#include "types.h" +#ifdef __MINGW32__ +#include "../libswarmtv/types.h" +#else +#include "types.h". +#endif #include "database.h" #include "logfile.h" #include "handleopts.h" diff --git a/trunk/swarmtv/swarmtv.pro b/trunk/swarmtv/swarmtv.pro index 07b05fe..805c0d3 100644 --- a/trunk/swarmtv/swarmtv.pro +++ b/trunk/swarmtv/swarmtv.pro @@ -1,6 +1,6 @@ -TEMPLATE = subdirs -SUBDIRS = libswarmtv \ - shellfront -win32{ -SUBDIRS += winservice -} +TEMPLATE = subdirs +SUBDIRS = libswarmtv \ + shellfront +win32{ +SUBDIRS += winservice +} diff --git a/trunk/swarmtv/winservice/swartvservice.pro b/trunk/swarmtv/winservice/swartvservice.pro new file mode 100644 index 0000000..f25255b --- /dev/null +++ b/trunk/swarmtv/winservice/swartvservice.pro @@ -0,0 +1,11 @@ +###################################################################### +# JinXed Thu Mar 10 14:22:41 2011 Anne Jan Brouwer +###################################################################### + +TEMPLATE = app +TARGET = +DEPENDPATH += . ../libswarmtv +INCLUDEPATH += . ../libswarmtv +LIBS += -L../libswarmtv -lswarmtv -lwsock32 -lws2_32 +# Input +SOURCES += swarmtvservice.c