summaryrefslogtreecommitdiff
path: root/updater/common.h
diff options
context:
space:
mode:
authorsje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2006-11-01 14:48:34 +0000
committersje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2006-11-01 14:48:34 +0000
commitd123e0ce94bf90b2adb0a4000930eb467e293226 (patch)
treed414dea59908105c4d2f256199a610e0a69c8690 /updater/common.h
parenta13e82647294da4add976a24335fec50d7bfe905 (diff)
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@16 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'updater/common.h')
-rw-r--r--updater/common.h185
1 files changed, 185 insertions, 0 deletions
diff --git a/updater/common.h b/updater/common.h
new file mode 100644
index 0000000..460bdc8
--- /dev/null
+++ b/updater/common.h
@@ -0,0 +1,185 @@
+#ifndef _COMMON_INC
+#define _COMMON_INC
+
+#define _CRT_SECURE_NO_DEPRECATE
+
+#define _WIN32_WINNT 0x0400
+#define WINVER 0x0400
+#define _WIN32_IE 0x0400
+
+#ifdef _UNICODE
+//#define _GLIBCXX_USE_WCHAR_T 1
+//#define _GLIBCXX_USE_WSTRING 1
+#endif
+
+// uses mim 0.6 options pages if available
+#define MIRANDA_VER 0x0600
+
+#include <windows.h>
+#include <commctrl.h>
+
+#include "tinyxml.h"
+#ifdef _MSC_VER
+#pragma warning( disable : 4786 )
+#endif
+
+#include <process.h>
+#include <shlobj.h>
+#include <stdio.h>
+
+#include <newpluginapi.h>
+#include <m_database.h>
+#include <m_langpack.h>
+#include <m_options.h>
+#include <m_system.h>
+#include <m_idle.h>
+#include <m_clui.h>
+#include <m_netlib.h>
+#include <m_utils.h>
+#include <m_clist.h>
+//#include "../mwclist/m_clist.h"
+#include <m_genmenu.h>
+#include <m_updater.h>
+
+#include <m_trigger.h>
+#include "IcoLib.h"
+
+#include <m_folders.h>
+
+//#define TESTING // causes version to be 0.0.0.1
+//#define USE_MY_SERVER // uses URLS for scottellis.com.au test site for non-beta
+//#define PLUGDIR // expect the zip archive to contain plugins/updater.dll rather than just updater.dll
+#define REGISTER_BETA // register beta urls for beta site
+//#define DEBUG_POPUPS // define to show some popups (restoring status, etc)
+//#define _UD_LOGGING // define to log some stuff, from inside the external process, overwriting the data file
+//#define DEBUG_HTTP_POPUPS // define to show popups re http
+#define REGISTER_AUTO // get updater to automatically collect file listing URL's from backend xml data
+
+#define BETA_HOST_URL_PREFIX "http://www.scottellis.com.au/miranda_plugins" //(thanks Omniwolf for old twosx webspace, thx Koobs for hosting my domain)
+
+typedef enum Category {MC_PLUGINS, MC_LOCALIZATION, MC_UNKNOWN, NUM_CATEGORIES};
+
+typedef struct UpdateOptions_tag {
+ bool enabled; // user has enabled updates for this plugin
+ bool use_beta; // use the beta update data
+ bool fixed; // use_beta flag is fixed - cannot be changed by user (e.g. szUpdateURL is null, szBetaUpdateURL is not)
+} UpdateOptions;
+
+typedef struct UpdateInternal_tag {
+ Update update;
+ UpdateOptions update_options;
+ int file_id; // miranda file listing id
+ bool auto_register;
+ char *newVersion;
+
+ Category cat;
+
+ char *shortName;
+} UpdateInternal;
+
+class UpdateList {
+public:
+ UpdateList();
+ virtual ~UpdateList();
+ UpdateList(UpdateList &source);
+
+ int size();
+
+ void push_back(UpdateInternal &update);
+
+ UpdateInternal &back();
+
+ void clear();
+ void reset();
+ void next();
+ UpdateInternal *current();
+ void erase();
+
+protected:
+ class Node {
+ public:
+ Node(): next(0), prev(0) {}
+ UpdateInternal ui;
+ Node *next, *prev;
+ };
+
+ int count;
+ Node *head, *tail, *it_current;
+};
+
+class StringList {
+public:
+ StringList(): head(0), count(0) {}
+ virtual ~StringList() {clear();}
+
+ int size() {return count;}
+
+ void push_back(TCHAR *str) { Node *n = new Node; n->next = head; head = n; n->val = _tcsdup(str); }
+
+ void clear() {
+ Node *current;
+ while(head) {
+ current = head;
+ head = head->next;
+ free(current->val);
+ delete current;
+ }
+ count = 0;
+ reset();
+ }
+ void reset() {it_current = head;}
+ void next() {if(it_current) it_current = it_current->next;}
+ TCHAR *current() {return (it_current ? it_current->val : 0);}
+
+protected:
+ class Node {
+ public:
+ Node(): next(0) {}
+ TCHAR *val;
+ Node *next;
+ };
+
+ Node *head, *it_current;
+ int count;
+};
+
+#include <map>
+#include <list>
+#include <string>
+
+#ifdef _UNICODE
+typedef std::wstring STDString;
+#else
+typedef std::string STDString;
+#endif
+
+typedef std::list< STDString > STDStringList;
+typedef std::map<int, STDStringList > FilenameMap;
+
+#include "resource.h"
+
+#define MODULE "Updater"
+
+extern HINSTANCE hInst;
+extern PLUGINLINK *pluginLink;
+extern PLUGININFO pluginInfo;
+
+extern bool is_idle;
+
+extern HANDLE hNetlibUser;
+
+extern HANDLE mainThread;
+extern DWORD mainThreadId;
+
+static int __inline NLog(char *msg) {
+ return CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, (LPARAM)msg);
+}
+
+// clist 'exit' menu item command id
+#define ID_ICQ_EXIT 40001
+
+// maximum number of redirects when getting xml data or download files via HTTP
+#define MAX_REDIRECT_RECURSE 4
+
+#endif
+