00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef INCL_UTILS_DLL
00020 #define INCL_UTILS_DLL
00021
00026 #include "base/fscapi.h"
00027 #include "base/log.h"
00028 #include "spds/SyncReport.h"
00029 #include "WindowsSyncSource.h"
00030 #include "outlook/ClientRecurrence.h"
00031
00032 #include <string>
00033
00035 #define SYNCSOURCE_CALENDAR 1
00036 #define SYNCSOURCE_CONTACTS 2
00037 #define SYNCSOURCE_NOTES 3
00038 #define SYNCSOURCE_TASKS 4
00039
00040
00041
00042
00043
00044 int TimedMessageBox(HWND hwndOwner, LPCTSTR pszMessage, LPCTSTR pszTitle, UINT flags, DWORD dwTimeout);
00045
00046 int safeMessageBox (const char* message, const char* title = NULL, unsigned int flags = 0);
00047 int wsafeMessageBox(const WCHAR* wmessage, const WCHAR* wtitle = NULL, unsigned int flags = 0);
00048
00049 _declspec(dllexport) void printLog(const char* msg, const char* level = LOG_INFO);
00050 _declspec(dllexport) void printLog(const WCHAR* msg, const char* level = LOG_INFO);
00051
00052 bool isSIF (const std::wstring& dataType);
00053 bool isSIF (const std::string& dataType);
00054 bool isAcceptedDataType(const std::wstring& dataType);
00055 bool isAcceptedDataType(const std::string& dataType);
00056 char* syncModeName (SyncMode code);
00057 bool isFullSyncMode (SyncMode mode);
00058
00059 void toWindows (char* str);
00060 WCHAR* readAppDataPath ();
00061 WCHAR* readDataPath (const WCHAR* itemType);
00062 int makeDataDirs ();
00063 int getWindowsUser (std::wstring& userName);
00064 int getWindowsUserEx(std::wstring& userName);
00065
00066 std::wstring readFromFile (const std::wstring& filePath);
00067 int writeToFile (const std::wstring& content, const std::wstring& filePath, const WCHAR* mode = L"w");
00068 int writeToFile (const std::string& content, const std::string& filePath, const char* mode = "w");
00069 std::string getSyncMutexName ();
00070 char* readSystemErrorMsg (DWORD errorCode = 0);
00071 std::wstring getSafeItemName (ClientItem* cItem);
00072 void printReport (SyncReport* sr, WindowsSyncSource** sources);
00073 char* friendlyName (const char* sourceName);
00074
00075 int getBuildNumberFromVersion(const char* swv);
00076 long variantTimeToTimeStamp (const double vTime);
00077
00078 int syncSourceNameToIndex(const char*);
00079
00080
00081
00088 inline static bool isErrorStatus(int status) {
00089 return (status) && ((status < 200) || (status > 299));
00090 }
00091
00094 #endif