From 25221b7d2afb70f82eb3805330fd39a6f6708049 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Jun 2012 23:41:55 +0000 Subject: mk: removed all LIST_INTERFACE, MI_INTERFACE & UTF8_INTERFACE instances. all related functions moved to mir_core. git-svn-id: http://svn.miranda-ng.org/main/trunk@644 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- bin10/lib/mir_core.lib | Bin 21918 -> 23510 bytes bin10/lib/mir_core64.lib | Bin 21458 -> 23010 bytes include/m_core.h | 60 +++- include/m_system.h | 155 ---------- include/m_system_cpp.h | 1 - include/m_utils.h | 79 ----- plugins/AVS/main.cpp | 8 +- plugins/AddContactPlus/main.cpp | 2 - plugins/Alarms/alarms.cpp | 5 +- plugins/AssocMgr/main.cpp | 5 - plugins/AuthState/main.cpp | 5 +- plugins/AutoRun/main.cpp | 2 - plugins/BASS_interface/Main.cpp | 5 +- plugins/BasicHistory/BasicHistory.cpp | 46 ++- plugins/Boltun/boltun.cpp | 30 +- plugins/BossKeyPlus/BossKey.cpp | 2 - plugins/BuddyExpectator/BuddyExpectator.cpp | 5 +- plugins/CSList/cslist.cpp | 10 +- plugins/ChangeKeyboardLayout/main.cpp | 2 - plugins/Chat/main.cpp | 15 +- plugins/ClientChangeNotify/ClientChangeNotify.cpp | 2 - plugins/Clist_classic/init.cpp | 5 - plugins/Clist_modern/hdr/modern_commonprototypes.h | 3 - plugins/Clist_modern/init.cpp | 11 +- plugins/Clist_mw/commonheaders.h | 2 - plugins/Clist_mw/init.cpp | 11 +- plugins/Clist_nicer/INCLUDE/commonheaders.h | 1 - plugins/Clist_nicer/SRC/init.cpp | 10 +- plugins/Clist_nicer/skineditor/main.cpp | 5 - plugins/Console/Console.cpp | 18 +- plugins/CountryFlags/main.cpp | 4 +- plugins/CryptoPP/commonheaders.cpp | 3 +- plugins/CryptoPP/commonheaders.h | 7 +- plugins/CryptoPP/main.cpp | 1 - plugins/CyrTranslit/TransliterationProtocol.cpp | 4 +- plugins/CyrTranslit/main.cpp | 4 - plugins/Db3x/commonheaders.h | 3 +- plugins/Db3x/init.cpp | 10 +- plugins/Db3x_mmap/commonheaders.h | 3 - plugins/Db3x_mmap/init.cpp | 10 +- plugins/Db_autobackups/main.cpp | 2 - plugins/Dbx_mmap_SA/Import_SA/main.cpp | 4 - plugins/Dbx_mmap_SA/commonheaders.h | 3 - plugins/Dbx_mmap_SA/dbcontacts.cpp | 14 +- plugins/Dbx_mmap_SA/dbmodulechain.cpp | 16 +- plugins/Dbx_mmap_SA/dbpreset.cpp | 20 +- plugins/Dbx_mmap_SA/dbsettings.cpp | 28 +- plugins/Dbx_mmap_SA/init.cpp | 6 - plugins/Dbx_tree/DatabaseLink.cpp | 10 +- plugins/Dbx_tree/Interface.h | 7 +- plugins/ExternalAPI/m_music.h | 8 +- plugins/ExternalAPI/m_popup2.h | 4 +- plugins/ExternalAPI/m_variables.h | 22 -- plugins/ExtraIcons/extraicons.cpp | 5 - plugins/FavContacts/src/main.cpp | 7 - plugins/FingerPrintModPlus/src/fingerprint.cpp | 14 +- plugins/FirstRun/main.cpp | 2 - plugins/FlashAvatars/cflash.cpp | 4 - plugins/FloatingContacts/main.cpp | 187 ++++++------ plugins/Folders/folders.cpp | 2 - plugins/Gender/main.cpp | 2 - plugins/HistoryLinkListPlus/linklist.cpp | 3 - plugins/HistorySweeperLight/main.cpp | 3 - plugins/IEView/IEView.cpp | 1 - plugins/IEView/ieview.vcxproj | 2 +- plugins/IgnoreState/main.cpp | 5 +- plugins/Import/main.cpp | 4 - plugins/KeyboardNotify/main.cpp | 5 +- plugins/LangMan/main.cpp | 2 - plugins/ListeningTo/listeningto.cpp | 5 - plugins/MenuItemEx/main.cpp | 2 - plugins/MetaContacts/meta_main.cpp | 3 - plugins/MirOTR/MirOTR/dllmain.cpp | 4 - plugins/MirOTR/MirOTR/otr.cpp | 2 +- plugins/MirOTR/MirOTR/svcs_proto.cpp | 2 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/md5.c | 4 +- plugins/MirOTR/libgcrypt-1.4.6/cipher/sha1.c | 6 +- plugins/ModernOpt/main.cpp | 4 - plugins/NewAwaySysMod/AwaySys.cpp | 2 - plugins/NewEventNotify/main.c | 6 +- plugins/NewEventNotify/menuitem.c | 3 +- plugins/NewEventNotify/options.c | 2 +- plugins/NewXstatusNotify/common.h | 4 +- plugins/NewXstatusNotify/main.cpp | 192 ++++++------- plugins/NewXstatusNotify/options.cpp | 196 ++++++------- plugins/Nudge/main.cpp | 136 ++++----- plugins/PackUpdater/Src/PackUpdater.cpp | 2 - plugins/Popup/src/config.cpp | 3 - plugins/Popup/src/config.h | 2 - plugins/Popup/src/main.cpp | 14 +- plugins/QuickMessages/Utils.cpp | 18 +- plugins/QuickMessages/main.cpp | 37 ++- plugins/QuickMessages/options.cpp | 6 +- plugins/QuickMessages/quickmessages.h | 5 - plugins/QuickReplies/quickreplies.cpp | 5 +- plugins/Rate/main.cpp | 5 +- plugins/RecentContacts/RecentContacts.cpp | 7 +- plugins/SRMM/commonheaders.h | 9 +- plugins/SRMM/srmm.cpp | 6 - plugins/Scriver/richutil.cpp | 45 ++- plugins/Scriver/srmm.cpp | 6 - plugins/SecureIM/main.cpp | 14 +- plugins/SeenPlugin/main.cpp | 2 - plugins/Sessions/Src/Main.cpp | 144 +++++----- plugins/SimpleAR/Src/Main.cpp | 4 - plugins/SimpleStatusMsg/main.cpp | 3 - plugins/SmileyAdd/main.cpp | 7 - plugins/SpellChecker/spellchecker.cpp | 7 - plugins/SplashScreen/src/main.cpp | 5 +- plugins/StatusPlugins/AdvancedAutoAway/main.cpp | 4 - plugins/StatusPlugins/KeepStatus/main.cpp | 4 - plugins/StatusPlugins/StartupStatus/main.cpp | 4 - plugins/StopSpamPlus/src/stopspam.cpp | 7 +- plugins/Svc_crshdmp/crshdmp.cpp | 8 - plugins/Svc_dbepp/main.cpp | 4 - plugins/Svc_vi/main.cpp | 7 +- plugins/TabSRMM/src/commonheaders.h | 2 - plugins/TabSRMM/src/srmm.cpp | 5 - plugins/TipperYM/common.h | 8 +- plugins/TipperYM/tipper.cpp | 40 ++- plugins/TopToolBar/main.cpp | 4 - plugins/TopToolBar/toolbar.cpp | 4 +- plugins/TranslitSwitcher/Src/TranslitSwitcher.cpp | 4 - plugins/Updater/updater.cpp | 7 - plugins/UserGuide/main.cpp | 2 - plugins/UserInfoEx/commonheaders.cpp | 22 +- plugins/UserInfoEx/commonheaders.h | 9 +- plugins/UserInfoEx/init.cpp | 137 ++++----- plugins/Utils/mir_dblists.cpp | 14 +- plugins/Utils/mir_dblists.h | 18 +- plugins/Variables/main.cpp | 5 - plugins/Variables/tokenregister.cpp | 18 +- plugins/Variables/variables.cpp | 18 -- plugins/W7UI/main.cpp | 4 - plugins/WhenWasIt/WhenWasIt.cpp | 2 - plugins/YAPP/popups2.cpp | 5 - plugins/mir_core/mir_core_10.vcxproj | 3 +- plugins/mir_core/mir_core_10.vcxproj.filters | 5 +- plugins/mir_core/miranda.cpp | 15 +- plugins/mir_core/miranda.h | 3 - plugins/mir_core/timezones.cpp | 224 --------------- protocols/AimOscar/aim.cpp | 8 - protocols/FacebookRM/main.cpp | 8 - protocols/Gadu-Gadu/gg.c | 8 - protocols/Gadu-Gadu/gg.h | 1 - protocols/Gadu-Gadu/oauth.c | 6 +- protocols/IRCG/main.cpp | 6 - protocols/IcqOscarJ/init.cpp | 5 - protocols/JabberG/jabber.cpp | 14 +- protocols/MRA/Mra.cpp | 18 +- protocols/MSN/msn.cpp | 14 +- protocols/NewsAggregator/Src/NewsAggregator.cpp | 7 +- protocols/Omegle/main.cpp | 6 - protocols/Quotes/Forex.cpp | 4 - protocols/Twitter/main.cpp | 9 - protocols/Weather/weather.cpp | 5 - protocols/YAMN/main.cpp | 5 +- protocols/Yahoo/libyahoo2/config.h | 12 - protocols/Yahoo/libyahoo2/crypt.c | 52 ++-- protocols/Yahoo/libyahoo2/libyahoo2.c | 36 +-- protocols/Yahoo/main.cpp | 14 - protocols/Yahoo/yahoo.h | 1 - src/core/miranda.cpp | 112 ++++++-- src/miranda32_10.vcxproj | 11 +- src/miranda32_10.vcxproj.filters | 9 +- src/modules/langpack/lpservices.cpp | 2 + src/modules/utils/md5.cpp | 318 +-------------------- src/modules/utils/sha1.cpp | 175 ------------ src/modules/utils/timezones.cpp | 2 +- src/modules/utils/utils.cpp | 3 +- 170 files changed, 953 insertions(+), 2409 deletions(-) delete mode 100644 plugins/mir_core/timezones.cpp delete mode 100644 src/modules/utils/sha1.cpp diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib index 7a238b682c..54190681aa 100644 Binary files a/bin10/lib/mir_core.lib and b/bin10/lib/mir_core.lib differ diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib index dd51c84a24..22ab1784af 100644 Binary files a/bin10/lib/mir_core64.lib and b/bin10/lib/mir_core64.lib differ diff --git a/include/m_core.h b/include/m_core.h index 0aeff8ae2f..d1122460d7 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -195,6 +195,24 @@ MIR_CORE_DLL(int) List_RemovePtr(SortedList* list, void* p); MIR_CORE_DLL(void) List_Copy(SortedList* s, SortedList* d, size_t itemSize); MIR_CORE_DLL(void) List_ObjCopy(SortedList* s, SortedList* d, size_t itemSize); +/////////////////////////////////////////////////////////////////////////////// +// md5 functions + +/* Define the state of the MD5 Algorithm. */ +typedef unsigned char mir_md5_byte_t; /* 8-bit byte */ +typedef unsigned int mir_md5_word_t; /* 32-bit word */ + +typedef struct mir_md5_state_s { + mir_md5_word_t count[2]; /* message length in bits, lsw first */ + mir_md5_word_t abcd[4]; /* digest buffer */ + mir_md5_byte_t buf[64]; /* accumulate block */ +} mir_md5_state_t; + +MIR_CORE_DLL(void) mir_md5_init(mir_md5_state_t *pms); +MIR_CORE_DLL(void) mir_md5_append(mir_md5_state_t *pms, const mir_md5_byte_t *data, int nbytes); +MIR_CORE_DLL(void) mir_md5_finish(mir_md5_state_t *pms, mir_md5_byte_t digest[16]); +MIR_CORE_DLL(void) mir_md5_hash(const mir_md5_byte_t *data, int len, mir_md5_byte_t digest[16]); + /////////////////////////////////////////////////////////////////////////////// // memory functions @@ -240,6 +258,26 @@ MIR_CORE_DLL(int) mir_sntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt MIR_CORE_DLL(int) mir_vsnprintf(char *buffer, size_t count, const char* fmt, va_list va); MIR_CORE_DLL(int) mir_vsntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, va_list va); +/////////////////////////////////////////////////////////////////////////////// +// sha1 functions + +typedef unsigned char mir_sha1_byte_t; +typedef unsigned long mir_sha1_long_t; + +#define MIR_SHA1_HASH_SIZE 20 + +typedef struct { + mir_sha1_long_t H[5]; + mir_sha1_long_t W[80]; + int lenW; + mir_sha1_long_t sizeHi, sizeLo; +} mir_sha1_ctx; + +MIR_CORE_DLL(void) mir_sha1_init(mir_sha1_ctx *ctx); +MIR_CORE_DLL(void) mir_sha1_append(mir_sha1_ctx *ctx, mir_sha1_byte_t *dataIn, int len); +MIR_CORE_DLL(void) mir_sha1_finish(mir_sha1_ctx *ctx, mir_sha1_byte_t hashout[20]); +MIR_CORE_DLL(void) mir_sha1_hash(mir_sha1_byte_t *dataIn, int len, mir_sha1_byte_t hashout[20]); + /////////////////////////////////////////////////////////////////////////////// // strings @@ -329,12 +367,28 @@ public: /////////////////////////////////////////////////////////////////////////////// // threads +typedef void (__cdecl *pThreadFunc)(void*); +typedef unsigned (__stdcall *pThreadFuncEx)(void*); +typedef unsigned (__cdecl *pThreadFuncOwner)(void *owner, void* param); + MIR_CORE_DLL(INT_PTR) UnwindThreadPush(WPARAM wParam, LPARAM lParam); MIR_CORE_DLL(INT_PTR) UnwindThreadPop(WPARAM, LPARAM); MIR_CORE_DLL(void) UnwindThreadWait(void); -MIR_CORE_DLL(UINT_PTR) forkthread( void (__cdecl *threadcode)(void*), unsigned long stacksize, void *arg); -MIR_CORE_DLL(UINT_PTR) forkthreadex(void *sec, unsigned stacksize, unsigned (__stdcall *threadcode)(void*), void* owner, void *arg, unsigned *thraddr); +MIR_CORE_DLL(UINT_PTR) forkthread(pThreadFunc, unsigned long stacksize, void *arg); +MIR_CORE_DLL(UINT_PTR) forkthreadex(void *sec, unsigned stacksize, pThreadFuncEx, void* owner, void *arg, unsigned *thraddr); + +_inline HANDLE mir_forkthread(pThreadFunc aFunc, void* arg) +{ return (HANDLE)forkthread(aFunc, 0, arg); +} + +__inline HANDLE mir_forkthreadex(pThreadFuncEx aFunc, void* arg, int stackSize, unsigned* pThreadID) +{ return (HANDLE)forkthreadex(NULL, stackSize, aFunc, NULL, arg, pThreadID); +} + +__inline HANDLE mir_forkthreadowner(pThreadFuncOwner aFunc, void* owner, void* arg, unsigned* pThreadID) +{ return (HANDLE)forkthreadex(NULL, 0, (pThreadFuncEx)aFunc, owner, arg, pThreadID); +} MIR_CORE_DLL(void) KillObjectThreads(void* pObject); @@ -386,7 +440,7 @@ __forceinline char* mir_utf8decodeA(const char* src) #endif #ifndef MIR_CORE_EXPORTS - #if !defined( _WIN64 ) + #if !defined( WIN64 ) #pragma comment(lib, "mir_core.lib") #else #pragma comment(lib, "mir_core64.lib") diff --git a/include/m_system.h b/include/m_system.h index ffca735b4a..e8c22a9124 100644 --- a/include/m_system.h +++ b/include/m_system.h @@ -132,121 +132,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //returns 0 on success or nonzero on failure. #define MS_SYSTEM_REMOVEWAIT "Miranda/System/RemoveWait" -/* Returns Miranda's RTL/CRT function poiners to malloc() free() realloc() -- 0.1.2.2+ -This is useful for preallocation of memory for use with Miranda's services -that Miranda can free -- or reallocation of a block of memory passed with a service. -Do not use with memory unless it is explicitly expected the memory *can* -or *shall* be used in this way. the passed structure is expected to have it's .cbSize initialised - -wParam=0, lParam = (LPARAM) &MM_INTERFACE -*/ - -struct MM_INTERFACE -{ - size_t cbSize; - void* (*mmi_malloc) (size_t); - void* (*mmi_realloc) (void*, size_t); - void (*mmi_free) (void*); - - void* (*mmi_calloc) (size_t); - char* (*mmi_strdup) (const char *src); - wchar_t* (*mmi_wstrdup) (const wchar_t *src); - int (*mir_snprintf) (char *buffer, size_t count, const char* fmt, ...); - int (*mir_sntprintf) (TCHAR *buffer, size_t count, const TCHAR* fmt, ...); - int (*mir_vsnprintf) (char *buffer, size_t count, const char* fmt, va_list va); - int (*mir_vsntprintf) (TCHAR *buffer, size_t count, const TCHAR* fmt, va_list va); - - wchar_t* (*mir_a2u_cp) (const char* src, int codepage); - wchar_t* (*mir_a2u)(const char* src); - char* (*mir_u2a_cp)(const wchar_t* src, int codepage); - char* (*mir_u2a)(const wchar_t* src); -}; - -#define MS_SYSTEM_GET_MMI "Miranda/System/GetMMI" - -__forceinline INT_PTR mir_getMMI(struct MM_INTERFACE* dest) -{ - return 0; -} - -/* Returns the pointer to the simple lists manager. -If the sortFunc member of the list gets assigned, the list becomes sorted - -wParam=0, lParam = (LPARAM)LIST_INTERFACE* -*/ - -struct LIST_INTERFACE -{ - size_t cbSize; - - SortedList* (*List_Create)(int, int); - void (*List_Destroy)(SortedList*); - - void* (*List_Find)(SortedList*, void*); - int (*List_GetIndex)(SortedList*, void*, int*); - int (*List_Insert)(SortedList*, void*, int); - int (*List_Remove)(SortedList*, int); - int (*List_IndexOf)(SortedList*, void*); - - int (*List_InsertPtr)(SortedList* list, void* p); - int (*List_RemovePtr)(SortedList* list, void* p); - - void (*List_Copy)(SortedList* src, SortedList* dst, size_t); - void (*List_ObjCopy)(SortedList* src, SortedList* dst, size_t); -}; - -#define MS_SYSTEM_GET_LI "Miranda/System/GetLI" - -__forceinline INT_PTR mir_getLI(struct LIST_INTERFACE* dest) -{ - return 0; -} - -/* - UTF8 Manager interface. 0.5.2+ - - Contains functions for utf8-strings encoding & decoding -*/ - -#define UTF8_INTERFACE_SIZEOF_V1 (sizeof(size_t)+5*sizeof(void*)) -#define UTF8_INTERFACE_SIZEOF_V2 (sizeof(size_t)+6*sizeof(void*)) - -struct UTF8_INTERFACE -{ - size_t cbSize; - - // decodes utf8 and places the result back into the same buffer. - // if the second parameter is present, the additional wchar_t* string gets allocated, - // and filled with the decoded utf8 content without any information loss. - // this string should be freed using mir_free() - char* (*utf8_decode)(char* str, wchar_t** ucs2); - char* (*utf8_decodecp)(char* str, int codepage, wchar_t** ucs2); - - // encodes an ANSI string into a utf8 format using the current langpack code page, - // or CP_ACP, if lanpack is missing - // the resulting string should be freed using mir_free - char* (*utf8_encode)(const char* src); - char* (*utf8_encodecp)(const char* src, int codepage); - - // encodes an WCHAR string into a utf8 format - // the resulting string should be freed using mir_free - char* (*utf8_encodeW)(const wchar_t* src); - - // decodes utf8 and returns the result as wchar_t* that should be freed using mir_free() - // the input buffer remains unchanged - wchar_t* (*utf8_decodeW)(const char* str); - - // returns the predicted length of the utf-8 string - int (*utf8_lenW)(const wchar_t* src); -}; - -#define MS_SYSTEM_GET_UTFI "Miranda/System/GetUTFI" - -__forceinline INT_PTR mir_getUTFI(struct UTF8_INTERFACE* dest) -{ - return 0; -} - /* -- Thread Safety -- @@ -342,15 +227,8 @@ registers a thread in the core and forks it */ -typedef void (__cdecl *pThreadFunc)(void*); - #define MS_SYSTEM_FORK_THREAD "Miranda/Thread/Fork" -__forceinline HANDLE mir_forkthread(pThreadFunc aFunc, void* arg) -{ - return (HANDLE)CallService(MS_SYSTEM_FORK_THREAD, (WPARAM)aFunc, (LPARAM)arg); -} - /* 0.5.2+ wParam=void* - thread owner object lParam=FORK_THREADEX_PARAMS* @@ -360,9 +238,6 @@ passes the extended parameters info and returns the thread id */ -typedef unsigned (__stdcall *pThreadFuncEx)(void* param); -typedef unsigned (__cdecl *pThreadFuncOwner)(void *owner, void* param); - typedef struct { pThreadFuncEx pFunc; @@ -374,36 +249,6 @@ typedef struct #define MS_SYSTEM_FORK_THREAD_EX "Miranda/Thread/ForkEx" -static __inline HANDLE mir_forkthreadex(pThreadFuncEx aFunc, void* arg, int stackSize, unsigned* pThreadID) -{ - FORK_THREADEX_PARAMS params; - params.pFunc = aFunc; - params.arg = arg; - params.iStackSize = stackSize; - params.threadID = pThreadID; - return (HANDLE)CallService(MS_SYSTEM_FORK_THREAD_EX, 0, (LPARAM)¶ms); -} - -/* 0.8.0+ -wParam=(void*)owner -lParam=FORK_THREADEX_PARAMS* - -registers a thread, owned by some object, in the core and forks it -passes the owner info and extended parameters info and returns the thread id - -*/ - -static __inline HANDLE mir_forkthreadowner(pThreadFuncOwner aFunc, void* owner, void* arg, unsigned* pThreadID) -{ - FORK_THREADEX_PARAMS params; - params.pFunc = (pThreadFuncEx)aFunc; - params.arg = arg; - params.iStackSize = 0; - params.threadID = pThreadID; - return (HANDLE)CallService(MS_SYSTEM_FORK_THREAD_EX, (WPARAM)owner, (LPARAM)¶ms); -} - - /* wParam=0 lParam=0 diff --git a/include/m_system_cpp.h b/include/m_system_cpp.h index 086eba0fc3..5815e410a4 100644 --- a/include/m_system_cpp.h +++ b/include/m_system_cpp.h @@ -32,7 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #if defined(__cplusplus) -extern LIST_INTERFACE li; #define NumericKeySortT -1 #define HandleKeySortT -2 diff --git a/include/m_utils.h b/include/m_utils.h index ad8b99e46d..57cde573e4 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -432,85 +432,6 @@ __inline static TCHAR* Utils_ReplaceVarsT(const TCHAR *szData) { #define MS_UTILS_GETBITMAPFILTERSTRINGST MS_UTILS_GETBITMAPFILTERSTRINGS #endif -/* - MD5 interface. 0.7.0.12 - - Contains functions for md5 handling -*/ -/* Define the state of the MD5 Algorithm. */ -typedef unsigned char mir_md5_byte_t; /* 8-bit byte */ -typedef unsigned int mir_md5_word_t; /* 32-bit word */ - -typedef struct mir_md5_state_s { - mir_md5_word_t count[2]; /* message length in bits, lsw first */ - mir_md5_word_t abcd[4]; /* digest buffer */ - mir_md5_byte_t buf[64]; /* accumulate block */ -} mir_md5_state_t; - -struct MD5_INTERFACE -{ - int cbSize; - void (*md5_init) (mir_md5_state_t *pms); - void (*md5_append) (mir_md5_state_t *pms, const mir_md5_byte_t *data, int nbytes); - void (*md5_finish) (mir_md5_state_t *pms, mir_md5_byte_t digest[16]); - void (*md5_hash) (const mir_md5_byte_t *data, int len, mir_md5_byte_t digest[16]); -}; - -#define MS_SYSTEM_GET_MD5I "Miranda/System/GetMD5I" - -static __inline INT_PTR mir_getMD5I(struct MD5_INTERFACE* dest) -{ - dest->cbSize = sizeof(*dest); - return CallService(MS_SYSTEM_GET_MD5I, 0, (LPARAM)dest); -} - -extern struct MD5_INTERFACE md5i; - -#define mir_md5_init(A) md5i.md5_init(A) -#define mir_md5_append(A,B,C) md5i.md5_append(A,B,C) -#define mir_md5_finish(A,B) md5i.md5_finish(A,B) -#define mir_md5_hash(A,B,C) md5i.md5_hash(A,B,C) - -/* - SHA1 interface. 0.7.0.12 - - Contains functions for SHA1 handling -*/ -typedef unsigned char mir_sha1_byte_t; -typedef unsigned long mir_sha1_long_t; -#define MIR_SHA1_HASH_SIZE 20 - -typedef struct { - mir_sha1_long_t H[5]; - mir_sha1_long_t W[80]; - int lenW; - mir_sha1_long_t sizeHi, sizeLo; -} mir_sha1_ctx; - -struct SHA1_INTERFACE -{ - int cbSize; - void (*sha1_init) (mir_sha1_ctx *ctx); - void (*sha1_append) (mir_sha1_ctx *ctx, mir_sha1_byte_t *dataIn, int len); - void (*sha1_finish) (mir_sha1_ctx *ctx, mir_sha1_byte_t hashout[20]); - void (*sha1_hash) (mir_sha1_byte_t *dataIn, int len, mir_sha1_byte_t hashout[20]); -}; - -#define MS_SYSTEM_GET_SHA1I "Miranda/System/GetSHA1I" - -static __inline INT_PTR mir_getSHA1I(struct SHA1_INTERFACE* dest) -{ - dest->cbSize = sizeof(*dest); - return CallService(MS_SYSTEM_GET_SHA1I, 0, (LPARAM)dest); -} - -extern struct SHA1_INTERFACE sha1i; - -#define mir_sha1_init(A) sha1i.sha1_init(A) -#define mir_sha1_append(A,B,C) sha1i.sha1_append(A,B,C) -#define mir_sha1_finish(A,B) sha1i.sha1_finish(A,B) -#define mir_sha1_hash(A,B,C) sha1i.sha1_hash(A,B,C) - // allows to include TCHAR* strings into mir_snprintf and NetLib_Logf calls #if defined(_UNICODE) #define TCHAR_STR_PARAM "%S" diff --git a/plugins/AVS/main.cpp b/plugins/AVS/main.cpp index 137ecf6b8d..75aa1cd71e 100644 --- a/plugins/AVS/main.cpp +++ b/plugins/AVS/main.cpp @@ -26,8 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE g_hInst = 0; PLUGINLINK *pluginLink; -MM_INTERFACE mmi; -LIST_INTERFACE li; int hLangpack; static TCHAR g_szDataPath[MAX_PATH]; // user datae path (read at startup only) @@ -2403,9 +2401,7 @@ static int OnDetailsInit(WPARAM wParam, LPARAM lParam) static int LoadAvatarModule() { - mir_getMMI ( &mmi ); - mir_getLI ( &li ); - mir_getLP( &pluginInfoEx ); + mir_getLP(&pluginInfoEx); init_mir_thread(); @@ -2433,7 +2429,7 @@ static int LoadAvatarModule() arServices.insert( CreateServiceFunction( MS_AV_RESIZEBITMAP, BmpFilterResizeBitmap )); arServices.insert( CreateServiceFunction( MS_AV_SETAVATARW, SetAvatarW )); arServices.insert( CreateServiceFunction( MS_AV_SETMYAVATARW, SetMyAvatarW )); - + hEventChanged = CreateHookableEvent(ME_AV_AVATARCHANGED); hEventContactAvatarChanged = CreateHookableEvent(ME_AV_CONTACTAVATARCHANGED); hMyAvatarChanged = CreateHookableEvent(ME_AV_MYAVATARCHANGED); diff --git a/plugins/AddContactPlus/main.cpp b/plugins/AddContactPlus/main.cpp index 95f1fac93d..3ce31e7a5e 100644 --- a/plugins/AddContactPlus/main.cpp +++ b/plugins/AddContactPlus/main.cpp @@ -26,7 +26,6 @@ int hLangpack; static HANDLE hModulesLoaded = 0, hChangedIcons = 0, hAccListChanged = 0, hMainMenuItem = 0, hToolBarItem = 0, hService = 0; HANDLE hIconLibItem; -struct MM_INTERFACE mmi; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -181,7 +180,6 @@ static int OnModulesLoaded(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load(PLUGINLINK* link) { pluginLink = link; - mir_getMMI(&mmi); mir_getLP(&pluginInfo); INITCOMMONCONTROLSEX icex = {0}; diff --git a/plugins/Alarms/alarms.cpp b/plugins/Alarms/alarms.cpp index 4c5f4179a6..19af4e7883 100644 --- a/plugins/Alarms/alarms.cpp +++ b/plugins/Alarms/alarms.cpp @@ -10,7 +10,6 @@ There is no warranty. #include "common.h" #include "alarms.h" -struct MM_INTERFACE mmi; #define SERVICENAME _T("mp") #define COMMANDPREFIX _T("/") SERVICENAME @@ -305,9 +304,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getLP(&pluginInfo); - mir_getMMI(&mmi); - + mir_getLP(&pluginInfo); // ensure datetime picker is loaded INITCOMMONCONTROLSEX ccx; ccx.dwSize = sizeof(ccx); diff --git a/plugins/AssocMgr/main.cpp b/plugins/AssocMgr/main.cpp index 2a1ad430a2..0d5c3dac82 100644 --- a/plugins/AssocMgr/main.cpp +++ b/plugins/AssocMgr/main.cpp @@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE hInst; PLUGINLINK *pluginLink; -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; static HANDLE hHookModulesLoaded; int hLangpack; @@ -105,9 +103,6 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) pluginLink=link; mir_getLP(&pluginInfo); - if (!ServiceExists(MS_DB_CONTACT_GETSETTING_STR)) return 1; /* dbx3x v0.5.1.0 */ - if(mir_getMMI(&mmi)) return 1; - if(mir_getUTFI(&utfi)) return 1; InitAssocList(); InitDde(); diff --git a/plugins/AuthState/main.cpp b/plugins/AuthState/main.cpp index 91e80262c4..c08a7bca86 100644 --- a/plugins/AuthState/main.cpp +++ b/plugins/AuthState/main.cpp @@ -32,7 +32,6 @@ static HANDLE hHookExtraIconsRebuild = NULL, hHookExtraIconsApply = NULL, hConta static HANDLE hPrebuildContactMenu = NULL, hAuthMenuSelected = NULL; static HANDLE hUserMenu = NULL; HANDLE hExtraIcon = NULL; -struct MM_INTERFACE mmi; int hLangpack; IconExtraColumn g_IECAuth = {0}; @@ -326,9 +325,7 @@ int onSystemOKToExit(WPARAM wParam,LPARAM lParam) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getLP(&pluginInfo); - mir_getMMI(&mmi); - + mir_getLP(&pluginInfo); hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded); hSystemOKToExit = HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit); hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged); diff --git a/plugins/AutoRun/main.cpp b/plugins/AutoRun/main.cpp index 478fc7aef5..638d10f211 100644 --- a/plugins/AutoRun/main.cpp +++ b/plugins/AutoRun/main.cpp @@ -4,7 +4,6 @@ HINSTANCE hInst; PLUGINLINK *pluginLink; HANDLE hHookOptionInit = NULL; int hLangpack; -struct MM_INTERFACE mmi; PLUGININFOEX pluginInfoEx= { // about plugin @@ -135,7 +134,6 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; mir_getLP(&pluginInfoEx); - mir_getMMI(&mmi); hHookOptionInit = HookEvent(ME_OPT_INITIALISE, AutorunOptInitialise); return 0; } diff --git a/plugins/BASS_interface/Main.cpp b/plugins/BASS_interface/Main.cpp index e667325770..bbea422e0d 100644 --- a/plugins/BASS_interface/Main.cpp +++ b/plugins/BASS_interface/Main.cpp @@ -22,7 +22,6 @@ PLUGININFOEX pluginInfo={ MIID_BASSINT }; -struct MM_INTERFACE mmi; static HANDLE hHooks[5] = {0}; static HANDLE hService; @@ -476,9 +475,7 @@ int OnShutdown(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getLP(&pluginInfo); - mir_getMMI(&mmi); - + mir_getLP(&pluginInfo); hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); hHooks[1] = HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); hHooks[2] = HookEvent(ME_TB_MODULELOADED, OnToolbarLoaded); diff --git a/plugins/BasicHistory/BasicHistory.cpp b/plugins/BasicHistory/BasicHistory.cpp index 9d1a3f0204..0897ab9ce9 100644 --- a/plugins/BasicHistory/BasicHistory.cpp +++ b/plugins/BasicHistory/BasicHistory.cpp @@ -25,8 +25,8 @@ along with this program. If not, see . // {E25367A2-51AE-4044-BE28-131BC18B71A4} #define MIID_BASICHISTORY { 0xe25367a2, 0x51ae, 0x4044, { 0xbe, 0x28, 0x13, 0x1b, 0xc1, 0x8b, 0x71, 0xa4 } } -#define MS_HISTORY_DELETEALLCONTACTHISTORY "BasicHistory/DeleteAllContactHistory" -#define MS_HISTORY_EXECUTE_TASK "BasicHistory/ExecuteTask" +#define MS_HISTORY_DELETEALLCONTACTHISTORY "BasicHistory/DeleteAllContactHistory" +#define MS_HISTORY_EXECUTE_TASK "BasicHistory/ExecuteTask" PLUGINLINK *pluginLink; HCURSOR hCurSplitNS, hCurSplitWE; @@ -58,24 +58,16 @@ PLUGININFOEX pluginInfo={ __AUTHOREMAIL, __COPYRIGHT, __AUTHORWEB, - UNICODE_AWARE, + UNICODE_AWARE, DEFMOD_UIHISTORY, MIID_BASICHISTORY }; -MM_INTERFACE mmi = {0}; TIME_API tmi = {0}; int hLangpack = 0; -UTF8_INTERFACE utfi = {0}; extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { - if (mirandaVersion < PLUGIN_MAKE_VERSION(0, 9, 0, 0)) - { - MessageBox(0, _T("This version of BasicHistory requires Miranda 0.9.0 or later. The plugin cannot be loaded."), _T("BasicHistory"), MB_OK | MB_ICONERROR); - return NULL; - } - return &pluginInfo; } @@ -101,7 +93,7 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) if (!count) mi.flags |= CMIF_HIDDEN; else mi.flags &= ~CMIF_HIDDEN; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi); - + mi.flags = CMIM_FLAGS; if (!count || !isInList) mi.flags |= CMIF_HIDDEN; else mi.flags &= ~CMIF_HIDDEN; @@ -145,7 +137,7 @@ void InitMenuItems() mi.position = 500060000; mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY; Menu_AddMainMenuItem(&mi); - + mi.position = 1000090001; mi.flags = CMIF_ICONFROMICOLIB; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE); @@ -170,7 +162,7 @@ void InitTaskMenuItems() mi.pszName = LPGEN("Execute history task"); hTaskMainMenu = Menu_AddMainMenuItem(&mi); } - + std::vector::iterator taskIt = Options::instance->taskOptions.begin(); std::vector::iterator it = taskMenus.begin(); for(; it != taskMenus.end() && taskIt != Options::instance->taskOptions.end(); ++it, ++taskIt) @@ -191,7 +183,7 @@ void InitTaskMenuItems() mi.hParentMenu = hTaskMainMenu; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HGENMENU)*it, (LPARAM)&mi); } - + int pos = (int)taskMenus.size(); for(; taskIt != Options::instance->taskOptions.end(); ++taskIt) { @@ -200,7 +192,7 @@ void InitTaskMenuItems() mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.pszService = MS_HISTORY_EXECUTE_TASK; mi.hParentMenu = hTaskMainMenu; - mi.popupPosition = pos++; + mi.popupPosition = pos++; mi.ptszName = (TCHAR*)taskIt->taskName.c_str(); HGENMENU menu = Menu_AddMainMenuItem(&mi); taskMenus.push_back(menu); @@ -227,7 +219,7 @@ void InitIcolib() sid.flags = SIDF_ALL_TCHAR; GetModuleFileName(hInst, stzFile, MAX_PATH); - + iconsNum = 3; hEventIcons = new HANDLE[iconsNum]; sid.pszName = "BasicHistory_in"; @@ -278,7 +270,7 @@ void InitIcolib() void InitUpdater() { - if (ServiceExists(MS_UPDATE_REGISTER)) + if (ServiceExists(MS_UPDATE_REGISTER)) { Update update = {0}; char szVersion[16]; @@ -299,7 +291,7 @@ void InitUpdater() update.szBetaUpdateURL = "http://programista.free.of.pl/miranda/BasicHistoryBeta.zip"; update.szBetaVersionURL = "http://programista.free.of.pl/miranda/pluginversion.php?plugin=basichistory&beta=yes"; update.szBetaChangelogURL = "http://programista.free.of.pl/miranda/BasicHistoryChangelog.txt"; - + #endif update.pbBetaVersionPrefix = update.pbVersionPrefix = (BYTE *)"Basic History "; update.cpbBetaVersionPrefix = update.cpbVersionPrefix = (int)strlen((char *)update.pbVersionPrefix); @@ -307,7 +299,7 @@ void InitUpdater() } } -INT_PTR ShowContactHistory(WPARAM wParam, LPARAM lParam) +INT_PTR ShowContactHistory(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; HistoryWindow::Open(hContact); @@ -331,7 +323,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { InitMenuItems(); InitUpdater(); - + TCHAR ftpExe[MAX_PATH]; if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, ftpExe))) { @@ -361,16 +353,16 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) mir_free(logAbsolute); Options::instance->Load(); InitTaskMenuItems(); - + hPreShutdownHistoryModule = HookEvent(ME_SYSTEM_PRESHUTDOWN,PreShutdownHistoryModule); hHistoryContactDelete = HookEvent(ME_DB_CONTACT_DELETED,HistoryContactDelete); hFontsChanged = HookEvent(ME_FONT_RELOAD, HistoryWindow::FontsChanged); hSysOK = HookEvent(ME_SYSTEM_OKTOEXIT, DoLastTask); - if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) + if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) { g_SmileyAddAvail = true; } - if (ServiceExists(MS_MC_GETPROTOCOLNAME)) + if (ServiceExists(MS_MC_GETPROTOCOLNAME)) { metaContactProto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); } @@ -384,10 +376,8 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) hTaskMainMenu = NULL; pluginLink = link; DuplicateHandle(GetCurrentProcess(),GetCurrentThread(),GetCurrentProcess(),&g_hMainThread,0,FALSE,DUPLICATE_SAME_ACCESS); - mir_getMMI(&mmi); mir_getTMI(&tmi); mir_getLP(&pluginInfo); - mir_getUTFI(&utfi); hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE); hServiceShowContactHistory = CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, ShowContactHistory); @@ -402,8 +392,8 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) return 0; } -extern "C" int __declspec(dllexport) Unload(void) -{ +extern "C" int __declspec(dllexport) Unload(void) +{ if(g_hMainThread) CloseHandle(g_hMainThread); g_hMainThread=NULL; UnhookEvent(hModulesLoaded); diff --git a/plugins/Boltun/boltun.cpp b/plugins/Boltun/boltun.cpp index a4ac93341a..2235ebf138 100644 --- a/plugins/Boltun/boltun.cpp +++ b/plugins/Boltun/boltun.cpp @@ -44,7 +44,6 @@ //#define DEBUG_LOAD_TIME -struct MM_INTERFACE mmi; int hLangpack; TalkBot* bot = NULL; @@ -234,11 +233,11 @@ static bool BoltunAutoChat(HANDLE hContact) return true; } - if ((DBGetContactSettingByte(hContact,"CList","NotOnList",0) == 1) && + if ((DBGetContactSettingByte(hContact,"CList","NotOnList",0) == 1) && Config.TalkWithNotInList) return true; - if (DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, + if (DBGetContactSettingByte(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE) == TRUE) return true; @@ -276,9 +275,9 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) free(dbei.pBlob); if (Config.MarkAsRead) CallService(MS_DB_EVENT_MARKREAD, wParam, lParam); - + AnswerToContact(hContact, s); - mir_free(s); + mir_free(s); return 0; } @@ -337,7 +336,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR if (HIWORD(wParam) != EN_CHANGE) notify = false; break; - } + } if (notify) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } @@ -358,14 +357,14 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR Config.PauseDepends = IsDlgButtonChecked(hwndDlg, IDC_PAUSEDEPENDS) == BST_CHECKED ? TRUE : FALSE; Config.PauseRandom = IsDlgButtonChecked(hwndDlg, IDC_PAUSERANDOM) == BST_CHECKED ? TRUE : FALSE; Config.AnswerPauseTime = GetDlgItemInt(hwndDlg, IDC_WAITTIME, &bTranslated, FALSE); - if (!bTranslated) + if (!bTranslated) Config.AnswerPauseTime = 2; Config.AnswerThinkTime = GetDlgItemInt(hwndDlg, IDC_THINKTIME, &bTranslated, FALSE); - if (!bTranslated) + if (!bTranslated) Config.AnswerThinkTime = 4; TCHAR c[MAX_WARN_TEXT]; bTranslated = GetDlgItemText(hwndDlg, IDC_WARNTXT, c, MAX_WARN_TEXT); - if(bTranslated) + if(bTranslated) Config.WarnText = c; else Config.WarnText = TranslateTS(DEFAULT_WARN_TEXT); @@ -421,14 +420,14 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP _tcscpy(filename, fullname); if (fullname != Config.MindFileName) delete[] fullname; - + ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = GetParent(hwndDlg); TCHAR* mind = TranslateTS(MIND_FILE_DESC); TCHAR* anyfile = TranslateTS(ALL_FILES_DESC); - size_t l = _tcslen(MIND_DIALOG_FILTER) + size_t l = _tcslen(MIND_DIALOG_FILTER) + _tcslen(mind) + _tcslen(anyfile); TCHAR *filt = new TCHAR[l]; wsprintf(filt, MIND_DIALOG_FILTER, mind, anyfile); @@ -436,7 +435,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (filt[i] == '\1') filt[i] = '\0'; ofn.lpstrFilter = filt; - + ofn.lpstrFile = filename; ofn.nMaxFile = fileNameSize; ofn.Flags = OFN_FILEMUSTEXIST; @@ -482,7 +481,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (!loading) { if (param == IDC_MINDFILE/* && HIWORD(wParam) != EN_CHANGE*/) - break; + break; SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } @@ -628,9 +627,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) pluginLink = link; mir_getLP(&pluginInfo); - mmi.cbSize=sizeof(struct MM_INTERFACE); - CallService(MS_SYSTEM_GET_MMI,0,(LPARAM)&mmi); - path = new TCHAR[MAX_PATH]; int len = GetModuleFileName(hInst, path, MAX_PATH); if (len > MAX_PATH) @@ -695,7 +691,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) extern "C" int __declspec(dllexport) Unload(void) { - if (pTimer) + if (pTimer) KillTimer(NULL, pTimer); if(blInit) { diff --git a/plugins/BossKeyPlus/BossKey.cpp b/plugins/BossKeyPlus/BossKey.cpp index 08d9dceed0..67f5604b0a 100644 --- a/plugins/BossKeyPlus/BossKey.cpp +++ b/plugins/BossKeyPlus/BossKey.cpp @@ -33,7 +33,6 @@ // unique to this DLL, not to be shared HINSTANCE g_hInstance; PLUGINLINK *pluginLink; -MM_INTERFACE mmi; CLIST_INTERFACE *pcli; HANDLE g_hmGenMenuInit, g_hIcon, g_hMenuItem, g_hHideService, g_hIsHiddenService; HANDLE g_hHooks[7]; @@ -861,7 +860,6 @@ int MirandaLoaded(WPARAM wParam,LPARAM lParam) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI( &mmi ); mir_getLP(&pluginInfo); g_wMaskAdv = DBGetContactSettingWord(NULL,MOD_NAME,"optsmaskadv",0); diff --git a/plugins/BuddyExpectator/BuddyExpectator.cpp b/plugins/BuddyExpectator/BuddyExpectator.cpp index e31bdf06c2..d4620de3dc 100644 --- a/plugins/BuddyExpectator/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/BuddyExpectator.cpp @@ -30,7 +30,6 @@ HINSTANCE hInst; PLUGINLINK *pluginLink; int hLangpack; -struct MM_INTERFACE mmi; DWORD timer_id = 0; @@ -888,9 +887,7 @@ int onSystemOKToExit(WPARAM wParam,LPARAM lParam) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getLP(&pluginInfo); - mir_getMMI(&mmi); - + mir_getLP(&pluginInfo); setlocale(LC_ALL, "English"); // Set English locale InitOptions(); diff --git a/plugins/CSList/cslist.cpp b/plugins/CSList/cslist.cpp index 5050ec39f5..cc0f0f989b 100644 --- a/plugins/CSList/cslist.cpp +++ b/plugins/CSList/cslist.cpp @@ -42,8 +42,6 @@ #include "strpos.h" #include "legacy.h" -MM_INTERFACE mmi; -LIST_INTERFACE li; SortedList *servicesList; int hLangpack; @@ -78,10 +76,8 @@ extern "C" __declspec( dllexport ) int Load( PLUGINLINK *link ) { // link plugin pluginLink = link; - mir_getMMI(&mmi); - mir_getLI(&li); mir_getLP(&pluginInfoEx); - servicesList = li.List_Create(0, 10); + servicesList = List_Create(0, 10); // support for ComboBoxEx { @@ -123,7 +119,7 @@ extern "C" __declspec( dllexport ) int Unload( void ) HANDLE *hService = (HANDLE *)servicesList->items[i]; DestroyServiceFunction(hService); } - li.List_Destroy(servicesList); + List_Destroy(servicesList); mir_free(servicesList); delete cslist; @@ -403,7 +399,7 @@ void CSList::addProtoStatusMenuItem( char* protoName, void* arg ) mir_snprintf(buf, SIZEOF(buf), "CSList/ShowList/%s", protoName); if (!ServiceExists(buf)) hService = CreateServiceFunctionParam(buf, CSList::showList, (LPARAM)protoName); - li.List_Insert(servicesList, hService, servicesList->realCount); + List_Insert(servicesList, hService, servicesList->realCount); CLISTMENUITEM mi = {0}; mi.cbSize = sizeof(mi); diff --git a/plugins/ChangeKeyboardLayout/main.cpp b/plugins/ChangeKeyboardLayout/main.cpp index f51977df2c..0aa7272bed 100644 --- a/plugins/ChangeKeyboardLayout/main.cpp +++ b/plugins/ChangeKeyboardLayout/main.cpp @@ -1,6 +1,5 @@ #include "commonheaders.h" -struct MM_INTERFACE mmi; PLUGINLINK *pluginLink; int hLangpack; LPTSTR ptszLayStrings[20]; @@ -50,7 +49,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI(&mmi); mir_getLP(&pluginInfoEx); ZeroMemory(hklLayouts, 20 * sizeof(HKL)); bLayNum = GetKeyboardLayoutList(20,hklLayouts); diff --git a/plugins/Chat/main.cpp b/plugins/Chat/main.cpp index e9c344ab61..11090d1fc0 100644 --- a/plugins/Chat/main.cpp +++ b/plugins/Chat/main.cpp @@ -27,9 +27,6 @@ HANDLE g_hWindowList; HMENU g_hMenu = NULL; int hLangpack; -struct MM_INTERFACE memoryManagerInterface; -struct UTF8_INTERFACE utfi; - FONTINFO aFonts[OPTIONS_FONTCOUNT]; HICON hIcons[30]; BOOL IEviewInstalled = FALSE; @@ -88,22 +85,12 @@ extern "C" __declspec(dllexport) const MUUID * MirandaPluginInterfaces(void) extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { BOOL bFlag = FALSE; - HINSTANCE hDll; - -#ifndef NDEBUG //mem leak detector :-) Thanks Tornado! - int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); // Get current flag - flag |= _CRTDBG_LEAK_CHECK_DF; // Turn on leak-checking bit - _CrtSetDbgFlag(flag); // Set flag to the new value -#endif - pluginLink = link; // set the memory & utf8 managers - mir_getMMI( &memoryManagerInterface ); - mir_getUTFI( &utfi ); mir_getLP( &pluginInfo ); - hDll = LoadLibraryA("riched20.dll"); + HINSTANCE hDll = LoadLibraryA("riched20.dll"); if ( hDll ) { char modulePath[MAX_PATH]; if (GetModuleFileNameA(hDll, modulePath, MAX_PATH)) { diff --git a/plugins/ClientChangeNotify/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/ClientChangeNotify.cpp index 4aaef02f6d..6159f4ea2b 100644 --- a/plugins/ClientChangeNotify/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/ClientChangeNotify.cpp @@ -36,7 +36,6 @@ HANDLE g_hMainThread; HANDLE g_hTogglePopupsMenuItem; PLUGINLINK *pluginLink; int hLangpack; -MM_INTERFACE mmi; TMyArray hHooks, hServices; COptPage *g_PreviewOptPage; // we need to show popup even for the NULL contact if g_PreviewOptPage is not NULL (used for popup preview) @@ -449,7 +448,6 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI( &mmi ); mir_getLP( &pluginInfo ); hHooks.AddElem(HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded)); diff --git a/plugins/Clist_classic/init.cpp b/plugins/Clist_classic/init.cpp index 06f935f367..3d97b81e6f 100644 --- a/plugins/Clist_classic/init.cpp +++ b/plugins/Clist_classic/init.cpp @@ -29,7 +29,6 @@ CLIST_INTERFACE* pcli = NULL; HIMAGELIST himlCListClc = NULL; int hLangpack; -struct MM_INTERFACE mmi; BOOL(WINAPI * MySetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD) = NULL; ///////////////////////////////////////////////////////////////////////////////////////// @@ -140,12 +139,8 @@ static INT_PTR GetStatusMode(WPARAM wParam, LPARAM lParam) extern "C" __declspec(dllexport) int CListInitialise(PLUGINLINK * link) { pluginLink = link; - #ifdef _DEBUG - _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); - #endif // get the internal malloc/free() - mir_getMMI( &mmi ); mir_getLP( &pluginInfo ); pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); diff --git a/plugins/Clist_modern/hdr/modern_commonprototypes.h b/plugins/Clist_modern/hdr/modern_commonprototypes.h index ad79a497ed..d1209100e0 100644 --- a/plugins/Clist_modern/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/hdr/modern_commonprototypes.h @@ -20,9 +20,6 @@ extern PLUGININFOEX pluginInfo; extern CLIST_INTERFACE * pcli; extern CLIST_INTERFACE corecli; -extern struct UTF8_INTERFACE utfi; -extern struct LIST_INTERFACE li; -extern struct MM_INTERFACE mmi; //Global variables extern int ON_SETALLEXTRAICON_CYCLE; diff --git a/plugins/Clist_modern/init.cpp b/plugins/Clist_modern/init.cpp index 1587656eb8..92d0d1dcfd 100644 --- a/plugins/Clist_modern/init.cpp +++ b/plugins/Clist_modern/init.cpp @@ -40,10 +40,7 @@ CLIST_INTERFACE corecli={0}; CLUIDATA g_CluiData={0}; int hLangpack; -MM_INTERFACE mmi; -LIST_INTERFACE li; -UTF8_INTERFACE utfi; -TIME_API tmi; +TIME_API tmi; pfnTryEnterCriticalSection fnTryEnterCriticalSection; @@ -113,10 +110,6 @@ PLUGININTERFACE int CListInitialise(PLUGINLINK * link) g_dwMainThreadID = GetCurrentThreadId(); DuplicateHandle(GetCurrentProcess(),GetCurrentThread(),GetCurrentProcess(),&g_hMainThread,0,FALSE,DUPLICATE_SAME_ACCESS); - - mir_getMMI(&mmi); - mir_getUTFI(&utfi); - mir_getLI(&li); mir_getTMI(&tmi); mir_getLP( &pluginInfo ); @@ -132,7 +125,7 @@ PLUGININTERFACE int CListInitialise(PLUGINLINK * link) CHECKRES ( ToolbarLoadModule() ); TRACE( "CListInitialise Modern Contact List ... Done\r\n" ); - + return S_OK; } diff --git a/plugins/Clist_mw/commonheaders.h b/plugins/Clist_mw/commonheaders.h index e8333401b2..8052fbbcfb 100644 --- a/plugins/Clist_mw/commonheaders.h +++ b/plugins/Clist_mw/commonheaders.h @@ -84,8 +84,6 @@ extern HINSTANCE g_hInst; */ -extern struct LIST_INTERFACE li; - #ifndef CS_DROPSHADOW #define CS_DROPSHADOW 0x00020000 #endif diff --git a/plugins/Clist_mw/init.cpp b/plugins/Clist_mw/init.cpp index d5167fffd5..8664014c83 100644 --- a/plugins/Clist_mw/init.cpp +++ b/plugins/Clist_mw/init.cpp @@ -28,8 +28,6 @@ PLUGINLINK * pluginLink; CLIST_INTERFACE* pcli = NULL; int hLangpack; -struct LIST_INTERFACE li; -struct MM_INTERFACE mmi; static HANDLE hCListShutdown = 0; HMENU BuildGroupPopupMenu( struct ClcGroup* group ); @@ -165,19 +163,12 @@ extern "C" int __declspec(dllexport) CListInitialise(PLUGINLINK * link) { int rc = 0; pluginLink = link; - #ifdef _DEBUG - _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); - #endif // get the internal malloc/free() __try { OutputDebugStringA("CListInitialise ClistMW\r\n"); - - mir_getMMI( &mmi ); - mir_getLP( &pluginInfo ); - mir_getLI( &li ); - + mir_getLP( &pluginInfo ); pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); if ( (INT_PTR)pcli == CALLSERVICE_NOTFOUND ) { LBL_Error: diff --git a/plugins/Clist_nicer/INCLUDE/commonheaders.h b/plugins/Clist_nicer/INCLUDE/commonheaders.h index 4f46b9d1d7..2b52d2734d 100644 --- a/plugins/Clist_nicer/INCLUDE/commonheaders.h +++ b/plugins/Clist_nicer/INCLUDE/commonheaders.h @@ -205,7 +205,6 @@ extern HINSTANCE g_hInst; #define MAX_REGS(_A_) (sizeof(_A_)/sizeof(_A_[0])) -extern struct LIST_INTERFACE li; typedef int (__cdecl *pfnDrawAvatar)(HDC hdcOrig, HDC hdcMem, RECT *rc, struct ClcContact *contact, int y, struct ClcData *dat, int selected, WORD cstatus, int rowHeight); #define safe_sizeof(a) (sizeof((a)) / sizeof((a)[0])) diff --git a/plugins/Clist_nicer/SRC/init.cpp b/plugins/Clist_nicer/SRC/init.cpp index 35384d9d4f..c5daa292b4 100644 --- a/plugins/Clist_nicer/SRC/init.cpp +++ b/plugins/Clist_nicer/SRC/init.cpp @@ -49,8 +49,6 @@ extern int SetHideOffline(WPARAM wParam, LPARAM lParam); extern DWORD g_gdiplusToken; extern HIMAGELIST himlExtraImages; -struct LIST_INTERFACE li; -struct MM_INTERFACE mmi; TIME_API tmi; HMENU BuildGroupPopupMenu( struct ClcGroup* group ); @@ -221,15 +219,9 @@ extern "C" int __declspec(dllexport) CListInitialise(PLUGINLINK * link) int rc = 0; DBVARIANT dbv; int i; - char szProfilePath[MAX_PATH]; + char szProfilePath[MAX_PATH]; pluginLink = link; -#ifdef _DEBUG - _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); -#endif - - mir_getMMI(&mmi); - mir_getLI(&li); mir_getTMI(&tmi); mir_getLP( &pluginInfo ); diff --git a/plugins/Clist_nicer/skineditor/main.cpp b/plugins/Clist_nicer/skineditor/main.cpp index f0e39de54e..b180316c28 100644 --- a/plugins/Clist_nicer/skineditor/main.cpp +++ b/plugins/Clist_nicer/skineditor/main.cpp @@ -42,7 +42,6 @@ PLUGININFOEX pluginInfo = { HINSTANCE g_hInst = 0; PLUGINLINK *pluginLink; -struct MM_INTERFACE memoryManagerInterface; int hLangpack; StatusItems_t *StatusItems; @@ -914,10 +913,6 @@ static HANDLE hSvc_invoke = 0, hSvc_fillby = 0; static int LoadModule() { - memset(&memoryManagerInterface, 0, sizeof(memoryManagerInterface)); - memoryManagerInterface.cbSize = sizeof(memoryManagerInterface); - CallService(MS_SYSTEM_GET_MMI, 0, (LPARAM) &memoryManagerInterface); - hSvc_invoke = CreateServiceFunction(MS_CLNSE_INVOKE, (MIRANDASERVICE)SkinEdit_Invoke); hSvc_fillby = CreateServiceFunction(MS_CLNSE_FILLBYCURRENTSEL, (MIRANDASERVICE)SkinEdit_FillByCurrentSel); return 0; diff --git a/plugins/Console/Console.cpp b/plugins/Console/Console.cpp index 3a5db7f64c..b0f0a97073 100644 --- a/plugins/Console/Console.cpp +++ b/plugins/Console/Console.cpp @@ -82,9 +82,6 @@ typedef struct { } LOGWIN; -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; -struct LIST_INTERFACE li; static SortedList lModules = {0}; @@ -750,7 +747,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,L if (!gSingleMode) { lw2.Module = dumpMsg->szModule; - if (!li.List_GetIndex(&lModules, &lw2, &idx)) + if (!List_GetIndex(&lModules, &lw2, &idx)) SendMessage(hwndDlg, HM_ADD, (WPARAM)idx, (LPARAM)dumpMsg->szModule); lw = (LOGWIN*)lModules.items[idx]; @@ -778,7 +775,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,L lw = (LOGWIN*)mir_calloc( sizeof(LOGWIN)); lw->Module = (char*)mir_strdup(str); - li.List_Insert(&lModules, lw, idx); + List_Insert(&lModules, lw, idx); if (!gSingleMode && lParam) { @@ -859,7 +856,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,L } } - li.List_RemovePtr(&lModules, lw); + List_RemovePtr(&lModules, lw); mir_free(lw->Module); mir_free(lw); return TRUE; @@ -1389,12 +1386,7 @@ static UINT logicons[] = {IDI_EMPTY, IDI_ARROW, IDI_IN, IDI_OUT, IDI_INFO}; void InitConsole() { int i; - HICON hi; - - mir_getMMI(&mmi); - mir_getUTFI(&utfi); - mir_getLI(&li); - + HICON hi; lModules.sortFunc = (FSortFunc)stringCompare; lModules.increment = 5; @@ -1433,7 +1425,7 @@ void ShutdownConsole(void) { int i; - li.List_Destroy(&lModules); + List_Destroy(&lModules); if (gImg) ImageList_Destroy(gImg); diff --git a/plugins/CountryFlags/main.cpp b/plugins/CountryFlags/main.cpp index af6229b09c..f39a24ace0 100644 --- a/plugins/CountryFlags/main.cpp +++ b/plugins/CountryFlags/main.cpp @@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE hInst; PLUGINLINK *pluginLink; -struct MM_INTERFACE mmi; int nCountriesCount; struct CountryListEntry *countries; int hLangpack; @@ -95,7 +94,7 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) /* existance of MS_SYSTEM_GETVERSION and MS_LANGPACK_TRANSLATESTRING * is checked in MirandaPluginInfo(). - * Not placed in MirandaPluginInfo() to avoid MessageBoxes on plugin options. + * Not placed in MirandaPluginInfo() to avoid MessageBoxes on plugin options. * Using ANSI as LANG_UNICODE might not be supported. */ if(CallService(MS_SYSTEM_GETVERSION,0,0)= 1300 //#pragma comment (compiler,"/GS-") -//#pragma comment (linker,"/NODEFAULTLIB:libcmt.lib") +//#pragma comment (linker,"/NODEFAULTLIB:libcmt.lib") //#pragma comment (lib,"../../lib/msvcrt.lib") //#pragma comment (lib,"../../lib/msvcrt71.lib") #else #ifndef _DEBUG #pragma optimize("gsy", on) #endif -#endif -#endif +#endif +#endif #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0501 @@ -101,7 +101,6 @@ extern BOOL isVista; extern HINSTANCE g_hInst; extern PLUGINLINK *pluginLink; extern PLUGININFOEX pluginInfoEx; -//extern MM_INTERFACE mmi; extern MUUID interfaces[]; extern HANDLE hPGPPRIV; diff --git a/plugins/CryptoPP/main.cpp b/plugins/CryptoPP/main.cpp index 4c0a798e52..8ef6c310f5 100644 --- a/plugins/CryptoPP/main.cpp +++ b/plugins/CryptoPP/main.cpp @@ -57,7 +57,6 @@ int Load(PLUGINLINK *link) { DisableThreadLibraryCalls(g_hInst); // get memoryManagerInterface address - mir_getMMI( &mmi ); mir_getLP(&pluginInfoEx); // register plugin module diff --git a/plugins/CyrTranslit/TransliterationProtocol.cpp b/plugins/CyrTranslit/TransliterationProtocol.cpp index 1af06afef4..1738aa818d 100644 --- a/plugins/CyrTranslit/TransliterationProtocol.cpp +++ b/plugins/CyrTranslit/TransliterationProtocol.cpp @@ -115,7 +115,7 @@ INT_PTR TransliterationProtocol::sendMessageW(WPARAM wParam, LPARAM lParam) INT_PTR TransliterationProtocol::sendMessageA(WPARAM wParam, LPARAM lParam) { - CCSDATA *ccs = reinterpret_cast(lParam); + CCSDATA *ccs = reinterpret_cast(lParam); LPARAM oldlParam = ccs->lParam; bool msgProcessed = true; @@ -132,7 +132,7 @@ INT_PTR TransliterationProtocol::sendMessageA(WPARAM wParam, LPARAM lParam) TranslateMessageA(wParam, lParam); } - int ret = CallService(MS_PROTO_CHAINSEND, wParam, lParam); + int ret = CallService(MS_PROTO_CHAINSEND, wParam, lParam); if(msgProcessed) { diff --git a/plugins/CyrTranslit/main.cpp b/plugins/CyrTranslit/main.cpp index 88e0aa31a9..ed33f8ef2d 100644 --- a/plugins/CyrTranslit/main.cpp +++ b/plugins/CyrTranslit/main.cpp @@ -22,8 +22,6 @@ HINSTANCE hInst; PLUGINLINK *pluginLink; -struct UTF8_INTERFACE utfi; -struct MM_INTERFACE mmi; int hLangpack = 0; PLUGININFOEX pluginInfoEx={ @@ -62,8 +60,6 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { //system inits: pluginLink = link; - mir_getUTFI(&utfi); - mir_getMMI(&mmi); mir_getLP(&pluginInfoEx); //plugin inits: PLACE IT ONLY AFTER THIS LINE diff --git a/plugins/Db3x/commonheaders.h b/plugins/Db3x/commonheaders.h index 4d31934ec9..a79ca1d357 100644 --- a/plugins/Db3x/commonheaders.h +++ b/plugins/Db3x/commonheaders.h @@ -56,7 +56,6 @@ extern struct DBHeader dbHeader; extern HANDLE hCacheHeap; extern SortedList lContacts; extern char szDbPath[MAX_PATH]; -extern struct LIST_INTERFACE li; #ifdef __GNUC__ #define mir_i64(x) (x##LL) @@ -68,4 +67,4 @@ extern struct LIST_INTERFACE li; #ifndef MODULAR void Encrypt(char*msg,BOOL up); -#endif \ No newline at end of file +#endif diff --git a/plugins/Db3x/init.cpp b/plugins/Db3x/init.cpp index 99740b93d0..cb37f20e81 100644 --- a/plugins/Db3x/init.cpp +++ b/plugins/Db3x/init.cpp @@ -23,9 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" -struct MM_INTERFACE mmi; -struct LIST_INTERFACE li; -struct UTF8_INTERFACE utfi; int hLangpack; HINSTANCE g_hInst=NULL; @@ -121,9 +118,7 @@ static int grokHeader( char * profile, int * error ) static int LoadDatabase( char * profile, void * plink ) { PLUGINLINK *link = (PLUGINLINK *)plink; -#ifdef _DEBUG - _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); -#endif + // don't need thread notifications strncpy(szDbPath, profile, sizeof(szDbPath)); @@ -131,9 +126,6 @@ static int LoadDatabase( char * profile, void * plink ) pluginLink=link; // set the memory, lists & UTF8 manager - mir_getLI( &li ); - mir_getMMI( &mmi ); - mir_getUTFI( &utfi ); mir_getLP( &pluginInfo ); // inject all APIs and hooks into the core diff --git a/plugins/Db3x_mmap/commonheaders.h b/plugins/Db3x_mmap/commonheaders.h index bc74ee267a..d5ec770353 100644 --- a/plugins/Db3x_mmap/commonheaders.h +++ b/plugins/Db3x_mmap/commonheaders.h @@ -55,9 +55,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern PLUGINLINK *pluginLink; -extern struct MM_INTERFACE memoryManagerInterface; -extern struct LIST_INTERFACE li; - extern CRITICAL_SECTION csDbAccess; extern struct DBHeader dbHeader; extern HANDLE hDbFile; diff --git a/plugins/Db3x_mmap/init.cpp b/plugins/Db3x_mmap/init.cpp index d62cf5afe2..7f01840a0e 100644 --- a/plugins/Db3x_mmap/init.cpp +++ b/plugins/Db3x_mmap/init.cpp @@ -23,9 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" -struct MM_INTERFACE mmi; -struct LIST_INTERFACE li; -struct UTF8_INTERFACE utfi; int hLangpack; extern char szDbPath[MAX_PATH]; @@ -121,9 +118,7 @@ static int grokHeader( char * profile, int * error ) static int LoadDatabase( char * profile, void * plink ) { PLUGINLINK *link = (PLUGINLINK *)plink; -#ifdef _DEBUG - _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); -#endif + // don't need thread notifications strncpy(szDbPath, profile, sizeof(szDbPath)); @@ -131,9 +126,6 @@ static int LoadDatabase( char * profile, void * plink ) pluginLink=link; // set the memory, lists & UTF8 manager - mir_getLI( &li ); - mir_getMMI( &mmi ); - mir_getUTFI( &utfi ); mir_getLP( &pluginInfo ); // inject all APIs and hooks into the core diff --git a/plugins/Db_autobackups/main.cpp b/plugins/Db_autobackups/main.cpp index 714c02d3f6..cef35ade51 100644 --- a/plugins/Db_autobackups/main.cpp +++ b/plugins/Db_autobackups/main.cpp @@ -2,7 +2,6 @@ #include "version.h" #include "m_trigger.h" -struct MM_INTERFACE mmi; HINSTANCE hInst; PLUGINLINK *pluginLink; int hLangpack; @@ -146,7 +145,6 @@ int PreShutdown(WPARAM wParam, LPARAM lParam) { void SysInit() { - mir_getMMI( &mmi ); mir_getLP( &pluginInfo ); OleInitialize(0); diff --git a/plugins/Dbx_mmap_SA/Import_SA/main.cpp b/plugins/Dbx_mmap_SA/Import_SA/main.cpp index 331984958a..ed83861e0f 100644 --- a/plugins/Dbx_mmap_SA/Import_SA/main.cpp +++ b/plugins/Dbx_mmap_SA/Import_SA/main.cpp @@ -46,8 +46,6 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPara HINSTANCE hInst; PLUGINLINK *pluginLink; static HWND hwndWizard = NULL; -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -131,8 +129,6 @@ static int OnExit(WPARAM wParam, LPARAM lParam) extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI( &mmi ); - mir_getUTFI( &utfi ); mir_getLP( &pluginInfo ); hImportService = CreateServiceFunction(IMPORT_SERVICE, ImportCommand); diff --git a/plugins/Dbx_mmap_SA/commonheaders.h b/plugins/Dbx_mmap_SA/commonheaders.h index 065fc3ab3e..8596e60821 100644 --- a/plugins/Dbx_mmap_SA/commonheaders.h +++ b/plugins/Dbx_mmap_SA/commonheaders.h @@ -62,9 +62,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern PLUGINLINK *pluginLink; -extern struct MM_INTERFACE memoryManagerInterface; -extern struct LIST_INTERFACE li; - extern CRITICAL_SECTION csDbAccess; extern struct DBHeader dbHeader; extern HANDLE hDbFile; diff --git a/plugins/Dbx_mmap_SA/dbcontacts.cpp b/plugins/Dbx_mmap_SA/dbcontacts.cpp index 51e533266d..0afd3469ab 100644 --- a/plugins/Dbx_mmap_SA/dbcontacts.cpp +++ b/plugins/Dbx_mmap_SA/dbcontacts.cpp @@ -62,8 +62,8 @@ DBCachedContactValueList* AddToCachedContactList(HANDLE hContact, int index) DBCachedContactValueList* VL; VL = (DBCachedContactValueList*)HeapAlloc(hCacheHeap,HEAP_ZERO_MEMORY,sizeof(DBCachedContactValueList)); VL->hContact = hContact; - if (index == -1) li.List_GetIndex(&lContacts,VL,&index); - li.List_Insert(&lContacts,VL,index); + if (index == -1) List_GetIndex(&lContacts,VL,&index); + List_Insert(&lContacts,VL,index); return VL; } @@ -115,7 +115,7 @@ static INT_PTR FindNextContact(WPARAM wParam,LPARAM lParam) VLtemp.hContact = (HANDLE)wParam; EnterCriticalSection(&csDbAccess); while(VLtemp.hContact) { - if ( li.List_GetIndex(&lContacts,&VLtemp,&index)) { + if ( List_GetIndex(&lContacts,&VLtemp,&index)) { VL = ( DBCachedContactValueList* )lContacts.items[index]; if (VL->hNext != NULL) { if (!lParam || CheckProto(VL->hNext,(const char*)lParam)) { @@ -174,7 +174,7 @@ static INT_PTR DeleteContact(WPARAM wParam,LPARAM lParam) { DBCachedContactValueList VLtemp; VLtemp.hContact = (HANDLE)wParam; - if ( li.List_GetIndex(&lContacts,&VLtemp,&index)) + if ( List_GetIndex(&lContacts,&VLtemp,&index)) { DBCachedContactValueList *VL = ( DBCachedContactValueList* )lContacts.items[index]; DBCachedContactValue* V = VL->first; @@ -188,7 +188,7 @@ static INT_PTR DeleteContact(WPARAM wParam,LPARAM lParam) if (VLtemp.hContact == hLastCachedContact) hLastCachedContact = NULL; - li.List_Remove(&lContacts,index); + List_Remove(&lContacts,index); } } dbc=(struct DBContact*)DBRead(wParam,sizeof(struct DBContact),NULL); @@ -229,7 +229,7 @@ static INT_PTR DeleteContact(WPARAM wParam,LPARAM lParam) { DBCachedContactValueList VLtemp; VLtemp.hContact = (HANDLE)ofsThis; - if ( li.List_GetIndex(&lContacts,&VLtemp,&index)) + if ( List_GetIndex(&lContacts,&VLtemp,&index)) { DBCachedContactValueList *VL = ( DBCachedContactValueList* )lContacts.items[index]; VL->hNext = ( HANDLE )ofsNext; @@ -285,7 +285,7 @@ static INT_PTR IsDbContact(WPARAM wParam,LPARAM lParam) int index; DBCachedContactValueList VLtemp; VLtemp.hContact = (HANDLE)wParam; - if ( li.List_GetIndex(&lContacts,&VLtemp,&index)) + if ( List_GetIndex(&lContacts,&VLtemp,&index)) ret = TRUE; else { dbc=(struct DBContact*)DBRead(ofsContact,sizeof(struct DBContact),NULL); diff --git a/plugins/Dbx_mmap_SA/dbmodulechain.cpp b/plugins/Dbx_mmap_SA/dbmodulechain.cpp index 62d0b6b3c7..cc73248182 100644 --- a/plugins/Dbx_mmap_SA/dbmodulechain.cpp +++ b/plugins/Dbx_mmap_SA/dbmodulechain.cpp @@ -50,15 +50,15 @@ void AddToList(char *name, DWORD len, DWORD ofs) mn->name = name; mn->ofs = ofs; - if (li.List_GetIndex(&lMods,mn,&index)) + if (List_GetIndex(&lMods,mn,&index)) DatabaseCorruption( _T("%s (Module Name not unique)")); - li.List_Insert(&lMods,mn,index); + List_Insert(&lMods,mn,index); - if (li.List_GetIndex(&lOfs,mn,&index)) + if (List_GetIndex(&lOfs,mn,&index)) DatabaseCorruption( _T("%s (Module Offset not unique)")); - li.List_Insert(&lOfs,mn,index); + List_Insert(&lOfs,mn,index); } @@ -98,8 +98,8 @@ int InitModuleNames(void) void UninitModuleNames(void) { HeapDestroy(hModHeap); - li.List_Destroy(&lMods); - li.List_Destroy(&lOfs); + List_Destroy(&lMods); + List_Destroy(&lOfs); } static DWORD FindExistingModuleNameOfs(const char *szName) @@ -114,7 +114,7 @@ static DWORD FindExistingModuleNameOfs(const char *szName) if (lastmn && ModCompare(&mn,lastmn) == 0) return lastmn->ofs; - if (li.List_GetIndex(&lMods,&mn,&index)) { + if (List_GetIndex(&lMods,&mn,&index)) { pmn = (ModuleName*)lMods.items[index]; lastmn = pmn; return pmn->ofs; @@ -168,7 +168,7 @@ char *GetModuleNameByOfs(DWORD ofs) mn.name = NULL; mn.ofs = ofs; - if (li.List_GetIndex(&lOfs,&mn,&index)) { + if (List_GetIndex(&lOfs,&mn,&index)) { pmn = (ModuleName*)lOfs.items[index]; lastmn = pmn; return pmn->name; diff --git a/plugins/Dbx_mmap_SA/dbpreset.cpp b/plugins/Dbx_mmap_SA/dbpreset.cpp index 3bf17a298e..9e04f56353 100644 --- a/plugins/Dbx_mmap_SA/dbpreset.cpp +++ b/plugins/Dbx_mmap_SA/dbpreset.cpp @@ -64,7 +64,7 @@ int InitPreset() // no preset if (!fp) return 0; - lstPresets = li.List_Create(0, 50); + lstPresets = List_Create(0, 50); lstPresets->sortFunc = (FSortFunc)DBPresetItem_Cmp; while(!feof(fp)) @@ -99,31 +99,31 @@ int InitPreset() case 'B': item = DBPresetItem_Create(szSection, szName, DBVT_BYTE); item->dbv.bVal = (BYTE)strtol(szValue+1,NULL,0); - li.List_InsertPtr(lstPresets, item); + List_InsertPtr(lstPresets, item); break; case 'w': case 'W': item = DBPresetItem_Create(szSection, szName, DBVT_WORD); item->dbv.wVal = (WORD)strtol(szValue+1,NULL,0); - li.List_InsertPtr(lstPresets, item); + List_InsertPtr(lstPresets, item); break; case 'd': case 'D': item = DBPresetItem_Create(szSection, szName, DBVT_DWORD); item->dbv.dVal = (DWORD)strtoul(szValue+1,NULL,0); - li.List_InsertPtr(lstPresets, item); + List_InsertPtr(lstPresets, item); break; case 's': case 'S': item = DBPresetItem_Create(szSection, szName, DBVT_ASCIIZ); item->dbv.pszVal = mir_strdup(szValue+1); - li.List_InsertPtr(lstPresets, item); + List_InsertPtr(lstPresets, item); break; case 'u': case 'U': item = DBPresetItem_Create(szSection, szName, DBVT_UTF8); item->dbv.pszVal = mir_strdup(szValue+1); - li.List_InsertPtr(lstPresets, item); + List_InsertPtr(lstPresets, item); break; case 'n': case 'N': @@ -142,7 +142,7 @@ int InitPreset() item = DBPresetItem_Create(szSection, szName, DBVT_BLOB); item->dbv.pbVal = buf; item->dbv.cpbVal = len; - li.List_InsertPtr(lstPresets, item); + List_InsertPtr(lstPresets, item); break; } } @@ -159,7 +159,7 @@ void UninitPreset() if (!lstPresets) return; for (i = 0; i < lstPresets->realCount; ++i) DBPresetItem_Destroy((DBPresetItem *)lstPresets->items[i]); - li.List_Destroy(lstPresets); + List_Destroy(lstPresets); } int DBPreset_QuerySetting(const char *szModule, const char *szSetting, DBVARIANT *dbv, BOOL isStatic) @@ -172,7 +172,7 @@ int DBPreset_QuerySetting(const char *szModule, const char *szSetting, DBVARIANT search.szModule = (char *)szModule; search.szSetting = (char *)szSetting; DBPresetItem_Hash(&search); - item = (DBPresetItem *)li.List_Find(lstPresets, &search); + item = (DBPresetItem *)List_Find(lstPresets, &search); if (!item) return FALSE; @@ -208,7 +208,7 @@ int DBPreset_CompareSetting(const char *szModule, const char *szSetting, DBVARIA search.szModule = (char *)szModule; search.szSetting = (char *)szSetting; DBPresetItem_Hash(&search); - item = (DBPresetItem *)li.List_Find(lstPresets, &search); + item = (DBPresetItem *)List_Find(lstPresets, &search); if (!item) return FALSE; if (item->dbv.type != item->dbv.type) return FALSE; diff --git a/plugins/Dbx_mmap_SA/dbsettings.cpp b/plugins/Dbx_mmap_SA/dbsettings.cpp index b34b7baba3..d8ad0e643e 100644 --- a/plugins/Dbx_mmap_SA/dbsettings.cpp +++ b/plugins/Dbx_mmap_SA/dbsettings.cpp @@ -68,7 +68,7 @@ static char* InsertCachedSetting( const char* szName, size_t cbNameLen, int inde char* newValue = (char*)HeapAlloc( hCacheHeap, 0, cbNameLen ); *newValue = 0; strcpy(newValue+1,szName+1); - li.List_Insert(&lSettings,newValue,index); + List_Insert(&lSettings,newValue,index); return newValue; } @@ -85,7 +85,7 @@ static char* GetCachedSetting(const char *szModuleName,const char *szSettingName if (lastsetting && strcmp(szFullName+1,lastsetting) == 0) return lastsetting; - if (li.List_GetIndex(&lSettings,szFullName,&index)) + if (List_GetIndex(&lSettings,szFullName,&index)) lastsetting = (char*)lSettings.items[index]+1; else lastsetting = InsertCachedSetting( szFullName, settingNameLen+moduleNameLen+3, index )+1; @@ -133,11 +133,11 @@ static DBVARIANT* GetCachedValuePtr( HANDLE hContact, char* szSetting, int bAllo if ( hContact == 0 ) { DBCachedGlobalValue Vtemp, *V; Vtemp.name = szSetting; - if ( li.List_GetIndex(&lGlobalSettings,&Vtemp,&index)) { + if ( List_GetIndex(&lGlobalSettings,&Vtemp,&index)) { V = (DBCachedGlobalValue*)lGlobalSettings.items[index]; if ( bAllocate == -1 ) { FreeCachedVariant( &V->value ); - li.List_Remove(&lGlobalSettings,index); + List_Remove(&lGlobalSettings,index); HeapFree(hCacheHeap,0,V); return NULL; } } @@ -147,7 +147,7 @@ static DBVARIANT* GetCachedValuePtr( HANDLE hContact, char* szSetting, int bAllo V = (DBCachedGlobalValue*)HeapAlloc(hCacheHeap,HEAP_ZERO_MEMORY,sizeof(DBCachedGlobalValue)); V->name = szSetting; - li.List_Insert(&lGlobalSettings,V,index); + List_Insert(&lGlobalSettings,V,index); } return &V->value; @@ -162,7 +162,7 @@ static DBVARIANT* GetCachedValuePtr( HANDLE hContact, char* szSetting, int bAllo else { VLtemp.hContact=hContact; - if ( !li.List_GetIndex(&lContacts,&VLtemp,&index)) + if ( !List_GetIndex(&lContacts,&VLtemp,&index)) { if ( bAllocate != 1 ) return NULL; @@ -529,20 +529,20 @@ static INT_PTR SetSettingResident(WPARAM wParam, LPARAM lParam) strcpy( szTemp+1, ( char* )lParam ); EnterCriticalSection(&csDbAccess); - if ( !li.List_GetIndex( &lSettings, szTemp, &idx )) + if ( !List_GetIndex( &lSettings, szTemp, &idx )) szSetting = InsertCachedSetting( szTemp, cbSettingNameLen, idx ); else szSetting = (char *)lSettings.items[idx]; *szSetting = (char)wParam; - if ( !li.List_GetIndex( &lResidentSettings, szSetting+1, &idx )) + if ( !List_GetIndex( &lResidentSettings, szSetting+1, &idx )) { if (wParam) - li.List_Insert(&lResidentSettings,szSetting+1,idx); + List_Insert(&lResidentSettings,szSetting+1,idx); } else if (!wParam) - li.List_Remove(&lResidentSettings,idx); + List_Remove(&lResidentSettings,idx); LeaveCriticalSection(&csDbAccess); } @@ -1163,8 +1163,8 @@ int InitSettings(void) void UninitSettings(void) { HeapDestroy(hCacheHeap); - li.List_Destroy(&lContacts); - li.List_Destroy(&lSettings); - li.List_Destroy(&lGlobalSettings); - li.List_Destroy(&lResidentSettings); + List_Destroy(&lContacts); + List_Destroy(&lSettings); + List_Destroy(&lGlobalSettings); + List_Destroy(&lResidentSettings); } diff --git a/plugins/Dbx_mmap_SA/init.cpp b/plugins/Dbx_mmap_SA/init.cpp index afc8cba593..0f2cc52ca4 100644 --- a/plugins/Dbx_mmap_SA/init.cpp +++ b/plugins/Dbx_mmap_SA/init.cpp @@ -23,9 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" -struct MM_INTERFACE mmi; -struct LIST_INTERFACE li; -struct UTF8_INTERFACE utfi; int hLangpack; extern char szDbPath[MAX_PATH]; @@ -132,9 +129,6 @@ static int LoadDatabase( char * profile, void * plink ) pluginLink=link; // set the memory, lists & UTF8 manager - mir_getLI( &li ); - mir_getMMI( &mmi ); - mir_getUTFI( &utfi ); mir_getLP( &pluginInfo ); { // Are we running under unicode Miranda core ? diff --git a/plugins/Dbx_tree/DatabaseLink.cpp b/plugins/Dbx_tree/DatabaseLink.cpp index b6cd91eda4..36110d141c 100644 --- a/plugins/Dbx_tree/DatabaseLink.cpp +++ b/plugins/Dbx_tree/DatabaseLink.cpp @@ -43,8 +43,6 @@ DATABASELINK gDBLink = { }; PLUGINLINK *pluginLink = NULL; -MM_INTERFACE mmi = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -UTF8_INTERFACE utfi = {0,0,0,0,0,0,0}; HANDLE hSystemModulesLoaded = 0; @@ -148,11 +146,7 @@ static int Load(char* profile, void* link) if (gDataBase) delete gDataBase; gDataBase = new CDataBase(profile); - pluginLink = (PLUGINLINK*)link; - - mir_getMMI(&mmi); - mir_getUTFI(&utfi); - + pluginLink = (PLUGINLINK*)link; RegisterServices(); CompatibilityRegister(); @@ -174,5 +168,3 @@ static int Unload(int wasLoaded) gDataBase = NULL; return 0; } - - diff --git a/plugins/Dbx_tree/Interface.h b/plugins/Dbx_tree/Interface.h index 9caa87cd74..b8e72e15ee 100644 --- a/plugins/Dbx_tree/Interface.h +++ b/plugins/Dbx_tree/Interface.h @@ -37,11 +37,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern HINSTANCE hInstance; extern PLUGINLINK *pluginLink; -extern MM_INTERFACE mmi; -extern UTF8_INTERFACE utfi; extern DATABASELINK gDBLink; -#endif +#endif #define gVersion 0x00000012 @@ -53,6 +51,3 @@ extern DATABASELINK gDBLink; #define gAutor "Michael 'Protogenes' Kunz" #define gAutorEmail "Michael.Kunz@s2005.TU-Chemnitz.de" #define gCopyright "2007 - 2010 Michael 'Protogenes' Kunz" - - - diff --git a/plugins/ExternalAPI/m_music.h b/plugins/ExternalAPI/m_music.h index 0246fabe34..f89dae99a0 100644 --- a/plugins/ExternalAPI/m_music.h +++ b/plugins/ExternalAPI/m_music.h @@ -79,7 +79,7 @@ typedef struct tSongInfo { #else #define WAT_INF_TCHAR WAT_INF_ANSI #define SongInfoT tSongInfoA -#endif +#endif // result codes #define WAT_RES_UNKNOWN -2 @@ -122,7 +122,7 @@ typedef struct tSongInfo { Affects: Fill structure by info from file named in SongInfo.mfile returns: 0, if success note: fields, which values can't be obtained, leaves old values. - you must free given strings by miranda mmi.free + you must free given strings by miranda mir_free */ #define MS_WAT_GETFILEINFO "WATrack/GetFileInfo" @@ -309,7 +309,7 @@ typedef struct tPlayerCell { HICON Icon; // can be 0. for registration only LPINITPROC Init; // LPINITPROC; can be NULL. initialize any data LPDEINITPROC DeInit; // LPDEINITPROC; can be NULL. finalize player processing - LPCHECKPROC Check; // check player + LPCHECKPROC Check; // check player LPSTATUSPROC GetStatus; // tStatusProc; can be NULL. get player status LPNAMEPROC GetName; // can be NULL. get media filename LPINFOPROC GetInfo; // can be NULL. get info from player @@ -346,7 +346,7 @@ typedef struct tLastFMInfo { UINT request; // 0 - artist, 1 - album, 2 - track WCHAR* artist; // artist WCHAR* album; // album or similar artists for Artist info request - WCHAR* title; // track title + WCHAR* title; // track title WCHAR* tags; // tags WCHAR* info; // artist bio or wiki article WCHAR* image; // photo/cover link diff --git a/plugins/ExternalAPI/m_popup2.h b/plugins/ExternalAPI/m_popup2.h index cec5abb395..5ccf169a0e 100644 --- a/plugins/ExternalAPI/m_popup2.h +++ b/plugins/ExternalAPI/m_popup2.h @@ -30,7 +30,7 @@ them! // popup you are requesting // ANSI Popup Action -typedef struct +typedef struct { int cbSize; // sizeof(POPUPACTION) HICON lchIcon; // Action Icon @@ -227,7 +227,7 @@ static int __inline PUChangeW(HWND hWndPopUp, POPUPDATAW_V2 *newData) { /* UM_CHANGEPOPUP This message is triggered by Change/ChangeText services. You also may post it directly, but make -sure you allocate memory via miranda mmi, because popup will mir_free() them! +sure you allocate memory via mir_alloc, because popup will mir_free() them! wParam = Modification type lParam = value of type defined by wParam diff --git a/plugins/ExternalAPI/m_variables.h b/plugins/ExternalAPI/m_variables.h index 0cba5216ce..77571f5522 100644 --- a/plugins/ExternalAPI/m_variables.h +++ b/plugins/ExternalAPI/m_variables.h @@ -55,26 +55,6 @@ // Note: Do only use this service to free memory that was *explicitliy* // stated that it should be free with this service. - - -#define MS_VARS_GET_MMI "Vars/GetMMI" - -// Get Variable's RTL/CRT function poiners to malloc(), free() and -// realloc(). - -// Parameters: -// ------------------------ -// wParam = 0 -// lParam = (LPARAM) &MM_INTERFACE -// Pointer to a memory manager interface struct (see m_system.h). - -// Return Value: -// ------------------------ -// Returns 0 on success, nozero otherwise - -// Note: Works exactly the same as the MS_SYSTEM_GET_MMI service -// service of m_system.h. - // Helper function for easy using: #ifndef VARIABLES_NOHELPER __inline static void variables_free(void *pntr) { @@ -83,8 +63,6 @@ __inline static void variables_free(void *pntr) { } #endif - - // -------------------------------------------------------------------------- // String formatting // -------------------------------------------------------------------------- diff --git a/plugins/ExtraIcons/extraicons.cpp b/plugins/ExtraIcons/extraicons.cpp index 8479bccdbd..9eaf35b3d3 100644 --- a/plugins/ExtraIcons/extraicons.cpp +++ b/plugins/ExtraIcons/extraicons.cpp @@ -37,8 +37,6 @@ PLUGININFOEX pluginInfo = { HINSTANCE hInst; PLUGINLINK *pluginLink; -MM_INTERFACE mmi; -UTF8_INTERFACE utfi; int hLangpack; vector hHooks; @@ -86,9 +84,6 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - - mir_getMMI(&mmi); - mir_getUTFI(&utfi); mir_getLP(&pluginInfo); DWORD ret = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS2, 0); diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 5aba9e88fb..be64692d00 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -24,9 +24,6 @@ DWORD g_mirandaVersion; PLUGINLINK* pluginLink = NULL; HINSTANCE g_hInst; -struct LIST_INTERFACE li; -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; int hLangpack; // {AC8B66B3-AFE1-4475-BABA-49783BA39A66} @@ -304,10 +301,6 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK * link) pluginLink = link; if (!CoreCheck()) return 1; - - mir_getLI(&li); - mir_getMMI(&mmi); - mir_getUTFI(&utfi); mir_getLP(&pluginInfo); g_contactCache = new CContactCache; diff --git a/plugins/FingerPrintModPlus/src/fingerprint.cpp b/plugins/FingerPrintModPlus/src/fingerprint.cpp index 1f5621e89e..c77539bb3f 100644 --- a/plugins/FingerPrintModPlus/src/fingerprint.cpp +++ b/plugins/FingerPrintModPlus/src/fingerprint.cpp @@ -17,7 +17,7 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + //Start of header #include "global.h" #include "fingerprints.h" //Including of fingerprint masks @@ -69,7 +69,6 @@ BOOL __inline WildCompareProcW(LPWSTR name, LPWSTR mask); HINSTANCE g_hInst; PLUGINLINK* pluginLink; -MM_INTERFACE mmi; // miranda memory interface int hLangpack; BOOL g_bExtraIcon_Register_ServiceExist = FALSE; @@ -116,7 +115,7 @@ PLUGININFOEX pluginInfoEx = { __LEGAL_COPYRIGHT_STRING, "http://code.google.com/p/fingerprintmod/", UNICODE_AWARE, - 0, + 0, MIID_THIS_PLUGIN }; @@ -157,7 +156,6 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces() extern "C" int __declspec(dllexport) Load(PLUGINLINK* link) { pluginLink = link; - mir_getMMI(&mmi); mir_getLP(&pluginInfoEx); hStaticHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); @@ -656,7 +654,7 @@ HICON FASTCALL LoadIconFromExternalFile(LPTSTR filename, int nLibrary, LPSTR Ico * should start from '|' e.g: "|first*submask|second*mask". * * Dec 25, 2006 by FYR: -* Added Exception to masks: the mask "|^mask3|mask2|mask1" means: +* Added Exception to masks: the mask "|^mask3|mask2|mask1" means: * if NOT according to mask 3 AND (mask1 OR mask2) * EXCEPTION should be BEFORE main mask: * IF Exception match - the comparing stops as FALSE @@ -712,7 +710,7 @@ BOOL FASTCALL WildCompareA(LPSTR szName, LPSTR szMask) * should start from '|' e.g: "|first*submask|second*mask". * * Dec 25, 2006 by FYR: -* Added Exception to masks: the mask "|^mask3|mask2|mask1" means: +* Added Exception to masks: the mask "|^mask3|mask2|mask1" means: * if NOT according to mask 3 AND (mask1 OR mask2) * EXCEPTION should be BEFORE main mask: * IF Exception match - the comparing stops as FALSE @@ -835,7 +833,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_NOTIFY: { NMHDR *hdr = (NMHDR *)lParam; - if (hdr && hdr->code == PSN_APPLY) + if (hdr && hdr->code == PSN_APPLY) { int i = SendDlgItemMessage(hwndDlg, IDC_ADVICON, CB_GETCURSEL, 0, 0) + 1; DBWriteContactSettingWord(NULL, "Finger", "Column", (WORD)i); @@ -886,7 +884,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP for (int i = 0; i < DEFAULT_SETTINGS_COUNT; i++) StoreDBCheckState(hwndDlg, settings[i].idCtrl, settings[i].szSetName); - + for(i = 0; i < DEFAULT_KN_FP_MASK_COUNT; i++) { mask = &def_kn_fp_mask[i]; diff --git a/plugins/FirstRun/main.cpp b/plugins/FirstRun/main.cpp index 7799a9c474..d67807d8f4 100644 --- a/plugins/FirstRun/main.cpp +++ b/plugins/FirstRun/main.cpp @@ -4,7 +4,6 @@ HINSTANCE hInst; PLUGINLINK *pluginLink; HANDLE hModulesLoaded; int hLangpack; -struct MM_INTERFACE mmi; PLUGININFOEX pluginInfo={ sizeof(PLUGININFOEX), @@ -56,7 +55,6 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink=link; mir_getLP(&pluginInfo); - mir_getMMI(&mmi); hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded); return 0; } diff --git a/plugins/FlashAvatars/cflash.cpp b/plugins/FlashAvatars/cflash.cpp index 326e7925e0..8750246c29 100644 --- a/plugins/FlashAvatars/cflash.cpp +++ b/plugins/FlashAvatars/cflash.cpp @@ -91,8 +91,6 @@ static int CompareFlashItems(const flash_avatar_item* p1, const flash_avatar_ite HINSTANCE g_hInst = 0; PLUGINLINK *pluginLink; -MM_INTERFACE mmi; -LIST_INTERFACE li; int hLangpack; HANDLE hNetlibUser; @@ -659,8 +657,6 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI(&mmi); - mir_getLI(&li); mir_getLP(&pluginInfo); hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, systemModulesLoaded); diff --git a/plugins/FloatingContacts/main.cpp b/plugins/FloatingContacts/main.cpp index 199cf1ee08..d907bc575a 100644 --- a/plugins/FloatingContacts/main.cpp +++ b/plugins/FloatingContacts/main.cpp @@ -30,7 +30,7 @@ No warranty for any misbehaviour. BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD); BOOL (WINAPI *pUpdateLayeredWindow) - (HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, + (HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags); // Globals @@ -40,7 +40,7 @@ static void LoadContacts ( void ); static void LoadContact ( HANDLE hContact ); // Internal funcs -static void RepaintWindow ( HWND hwnd, HDC hdc ); +static void RepaintWindow ( HWND hwnd, HDC hdc ); static void LoadMenus (); static void CreateThumbWnd ( TCHAR *ptszName, HANDLE hContact, int nX, int nY ); static void RegisterWindowClass ( void ); @@ -80,7 +80,6 @@ WNDPROC oldMirandaWndProc; HINSTANCE hInst = NULL; HMODULE hUserDll = NULL; PLUGINLINK *pluginLink = NULL; -LIST_INTERFACE li = {0}; HFONT hFont[FLT_FONTIDS] = {NULL}; COLORREF tColor[FLT_FONTIDS] = {0}; HIMAGELIST himl = NULL; @@ -149,16 +148,16 @@ static void InitOptions() { #define MIID_FLTCONT { 0x53c715a8, 0xeb01, 0x4136, { 0xa7, 0x3c, 0x44, 0x18, 0x68, 0x61, 0x0, 0x74 } } PLUGININFOEX pluginInfoEx = { - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - 0, - __DESC, - __AUTHOR, - __AUTHOREMAIL, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, - 0, + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + 0, + __DESC, + __AUTHOR, + __AUTHOREMAIL, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, + 0, MIID_FLTCONT }; @@ -167,7 +166,7 @@ _inline unsigned int MakeVer(int a, int b, int c, int d) return PLUGIN_MAKE_VERSION(a, b, c, d); } -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { return &pluginInfoEx; } @@ -178,16 +177,16 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { hInst = hinstDLL; - + switch ( fdwReason ) { - case DLL_PROCESS_ATTACH: + case DLL_PROCESS_ATTACH: break; case DLL_PROCESS_DETACH: break; } - + return( TRUE ); } @@ -196,21 +195,19 @@ extern "C" int __declspec(dllexport) Load( PLUGINLINK *link ) SetLastError( 0 ); InitOptions(); pluginLink = link; - - mir_getLI(&li); mir_getLP(&pluginInfoEx); hevModules = HookEvent( ME_SYSTEM_MODULESLOADED, OnModulesLoded ); bNT = GetOSPlatform(); if (hUserDll = LoadLibrary(_T("user32.dll"))) { - pSetLayeredWindowAttributes = + pSetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND, COLORREF, BYTE, DWORD)) GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); - pUpdateLayeredWindow = + pUpdateLayeredWindow = (BOOL (WINAPI *)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD)) GetProcAddress(hUserDll, "UpdateLayeredWindow"); - } + } else { pSetLayeredWindowAttributes = NULL; pUpdateLayeredWindow = NULL; @@ -245,11 +242,11 @@ static void CleanUp() UnhookEvent( hevModules ); UnhookEvent( hevPrebuildMenu ); - if (hRemoveThumb) + if (hRemoveThumb) DestroyServiceFunction(hRemoveThumb); - if (hMainHideAllThumbs) + if (hMainHideAllThumbs) DestroyServiceFunction(hMainHideAllThumbs); - if (hHideWhenCListShow) + if (hHideWhenCListShow) DestroyServiceFunction(hHideWhenCListShow); if (ServiceExists(MS_HOTKEY_UNREGISTER)) { @@ -299,14 +296,14 @@ static int OnModulesLoded( WPARAM wParam, LPARAM lParam ) hevPrebuildMenu = HookEvent( ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu ); hwndMiranda = (HWND)CallService( MS_CLUI_GETHWND, 0, 0 ); - oldMirandaWndProc = (WNDPROC)SetWindowLongPtr( hwndMiranda, GWLP_WNDPROC, (LONG)newMirandaWndProc); + oldMirandaWndProc = (WNDPROC)SetWindowLongPtr( hwndMiranda, GWLP_WNDPROC, (LONG)newMirandaWndProc); + + - - // No thumbs yet // pThumbsList = NULL; bEnableTip = ServiceExists("mToolTip/ShowTip"); - + RegisterWindowClass(); InitFileDropping(); GetScreenRect(); @@ -333,7 +330,7 @@ static int OnContactDeleted( WPARAM wParam, LPARAM lParam ) pThumb->DeleteContactPos(); thumbList.RemoveThumb(pThumb); - + return 0; } @@ -347,7 +344,7 @@ static int OnContactIconChanged( WPARAM wParam, LPARAM lParam ) { pThumb->RefreshContactIcon( ( int )lParam ); //pThumb->ThumbSelect( FALSE ); - //SetTimer( pThumb->hwnd, TIMERID_SELECT_T, 1000, NULL ); + //SetTimer( pThumb->hwnd, TIMERID_SELECT_T, 1000, NULL ); } return 0; @@ -363,10 +360,10 @@ static int OnContactDrag( WPARAM wParam, LPARAM lParam ) int idStatus = ID_STATUS_OFFLINE; POINT pt; GetCursorPos(&pt); - + if ( pThumb == NULL ) { idStatus = GetContactStatus( hContact ); - + if ( !fcOpt.bHideAll && !HideOnFullScreen() && ( !fcOpt.bHideOffline || IsStatusVisible( idStatus )) && (!fcOpt.bHideWhenCListShow || !bIsCListShow)) { CreateThumbWnd( ptName, hContact, pt.x, pt.y ); pNewThumb = thumbList.FindThumbByContact( hContact ); @@ -378,7 +375,7 @@ static int OnContactDrag( WPARAM wParam, LPARAM lParam ) } else if ( hContact == hNewContact ) pThumb->PositionThumb( (short)( pt.x - 5 ), (short)( pt.y - 5 )); - + return( hNewContact != NULL ? 1 : 0 ); } @@ -396,10 +393,10 @@ static int OnContactDrop( WPARAM wParam, LPARAM lParam ) if ( ( hNewContact == hContact ) && ( pThumb != NULL )) { hNewContact = NULL; - + GetWindowRect( hwndMiranda, &rcMiranda ); pThumb->GetThumbRect( &rcThumb ); - + //if ( IntersectRect( &rcOverlap, &rcThumb, &rcMiranda )) //{ // pThumb->OnLButtonDown( (short)(rcThumb.left + 5), (short)(rcThumb.top + 5)); @@ -431,7 +428,7 @@ static int OnSkinIconsChanged( WPARAM wParam, LPARAM lParam ) { // Get handle to the image list himl = ( HIMAGELIST )CallService( MS_CLIST_GETICONSIMAGELIST, 0, 0 ); - + // Update thumbs for (int i = 0; i < thumbList.getCount(); ++i) thumbList[i]->UpdateContent(); @@ -448,7 +445,7 @@ static int OnContactSettingChanged( WPARAM wParam, LPARAM lParam ) int idStatus = ID_STATUS_OFFLINE; BOOL bRefresh = TRUE; DBCONTACTWRITESETTING* pdbcws = ( DBCONTACTWRITESETTING* )lParam; - + if ( hContact == NULL ) { @@ -456,22 +453,22 @@ static int OnContactSettingChanged( WPARAM wParam, LPARAM lParam ) LoadDBSettings(); ApplyOptionsChanges(); } - + return( 0 ); } if ( pThumb == NULL ) return( 0 ); // Only on these 2 events we need to refresh - if ( 0 == stricmp( pdbcws->szSetting, "Status" )) + if ( 0 == stricmp( pdbcws->szSetting, "Status" )) { idStatus = pdbcws->value.wVal; } - else if ( 0 == stricmp( pdbcws->szSetting, "Nick" )) + else if ( 0 == stricmp( pdbcws->szSetting, "Nick" )) { idStatus = GetContactStatus( hContact ); } - else if ( 0 == stricmp( pdbcws->szSetting, "MyHandle" )) + else if ( 0 == stricmp( pdbcws->szSetting, "MyHandle" )) { idStatus = GetContactStatus( hContact ); } @@ -497,9 +494,9 @@ static int OnContactSettingChanged( WPARAM wParam, LPARAM lParam ) static int OnStatusModeChange( WPARAM wParam, LPARAM lParam ) { int idStatus; - + //nStatus = (int)wParam; - + for (int i = 0; i < thumbList.getCount(); ++i) { idStatus = GetContactStatus( thumbList[i]->hContact ); @@ -558,7 +555,7 @@ static void LoadDBSettings() if (DBGetContactSettingByte(NULL, "ModernData", "HideBehind", 0)) bIsCListShow = (DBGetContactSettingByte(NULL, "ModernData", "BehindEdge", 0) == 0); - else + else bIsCListShow = (DBGetContactSettingByte(NULL, "CList", "State", 0) == 2); } @@ -579,17 +576,17 @@ static void ShowContactMenu( HWND hwnd, POINT pt ) if ( pThumb != NULL ) { hContactMenu = (HMENU)CallService( MS_CLIST_MENUBUILDCONTACT, (WPARAM)pThumb->hContact, (LPARAM)0 ); - + if ( hContactMenu == NULL ) return; - + idCommand = TrackPopupMenu( hContactMenu, TPM_RIGHTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0 , hwnd, NULL ); CallService( MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM( idCommand , MPCF_CONTACTMENU), (LPARAM)pThumb->hContact ); } } -static LRESULT __stdcall CommWndProc( HWND hwnd, - UINT uMsg, - WPARAM wParam, +static LRESULT __stdcall CommWndProc( HWND hwnd, + UINT uMsg, + WPARAM wParam, LPARAM lParam ) { LRESULT lResult = 0; @@ -600,8 +597,8 @@ static LRESULT __stdcall CommWndProc( HWND hwnd, case WM_RBUTTONUP: { POINT pt; - pt.x = LOWORD( lParam ); - pt.y = HIWORD( lParam ); + pt.x = LOWORD( lParam ); + pt.y = HIWORD( lParam ); if (pThumb) pThumb->ThumbDeselect( TRUE ); @@ -766,7 +763,7 @@ static void RegisterWindowClass() { WNDCLASSEX wcx; ZeroMemory( &wcx, sizeof( wcx )); - + wcx.cbSize = sizeof( WNDCLASSEX ); wcx.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS; wcx.lpfnWndProc = CommWndProc; @@ -779,9 +776,9 @@ static void RegisterWindowClass() wcx.lpszMenuName = NULL; wcx.lpszClassName = WND_CLASS; wcx.hIconSm = NULL; - + SetLastError( 0 ); - + RegisterClassEx( &wcx ); } @@ -802,26 +799,26 @@ static void CreateThumbWnd( TCHAR *ptszName, HANDLE hContact, int nX, int nY ) // Prepare for window creation if ( pThumb == NULL ) { - hwnd = CreateWindowEx( WS_EX_TOOLWINDOW | WS_EX_TOPMOST, - WND_CLASS, - ptszName, - WS_POPUP, - nX, - nY, - 50, - 20, - NULL /*hwndMiranda*/, - NULL, - hInst, + hwnd = CreateWindowEx( WS_EX_TOOLWINDOW | WS_EX_TOPMOST, + WND_CLASS, + ptszName, + WS_POPUP, + nX, + nY, + 50, + 20, + NULL /*hwndMiranda*/, + NULL, + hInst, NULL ); - if ( hwnd != NULL ) + if ( hwnd != NULL ) { pThumb = thumbList.AddThumb( hwnd, ptszName, hContact ); SetWindowLongPtr( hwnd, GWLP_USERDATA, (long)pThumb ); pThumb->ResizeThumb(); - + pThumb->SetThumbOpacity( fcOpt.thumbAlpha ); ShowWindow( hwnd, ( fcOpt.bHideAll || HideOnFullScreen() || fcOpt.bHideOffline || (fcOpt.bHideWhenCListShow && bIsCListShow))? SW_HIDE : SW_SHOWNA ); pThumb->PositionThumb( (short)nX, (short)nY ); @@ -837,11 +834,11 @@ static void CreateThumbWnd( TCHAR *ptszName, HANDLE hContact, int nX, int nY ) static BOOL GetOSPlatform() { OSVERSIONINFO VersionInfo; - + // Get OS platform ZeroMemory( &VersionInfo, sizeof( VersionInfo )); VersionInfo.dwOSVersionInfoSize = sizeof( VersionInfo ); - + GetVersionEx( &VersionInfo ); return( VersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ); } @@ -866,7 +863,7 @@ static void CreateThumbsFont() HDC hdc = GetDC(NULL); height = lf.lfHeight; lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72); - ReleaseDC(NULL, hdc); + ReleaseDC(NULL, hdc); hFont[nFontId] = CreateFontIndirectA(&lf); @@ -946,12 +943,12 @@ static int GetContactStatus( HANDLE hContact ) } szProto = ( char* )CallService( "Proto/GetContactBaseProto", (WPARAM)hContact, 0 ); - + if ( NULL != szProto ) { idStatus = DBGetContactSettingWord( hContact, szProto, "Status", ID_STATUS_OFFLINE ); } - + return( idStatus ); } @@ -1033,15 +1030,15 @@ void RegHotkey( HANDLE hContact, HWND hwnd ) // Contact sttings void SaveContactsPos() -{ +{ RECT rc; - + for (int i = 0; i < thumbList.getCount(); ++i) { SetLastError( 0 ); thumbList[i]->GetThumbRect( &rc ); - + if ( 0 == GetLastError()) DBWriteContactSettingDword( thumbList[i]->hContact, sModule, "ThumbsPos", DB_POS_MAKE_XY(rc.left, rc.top)); } @@ -1064,7 +1061,7 @@ static void LoadMenus() { // Remove thumb menu item hRemoveThumb = CreateServiceFunction( sModule "/RemoveThumb", OnContactMenu_Remove ); - + CLISTMENUITEM mi = { 0 }; mi.cbSize = sizeof( mi ); mi.position = 0xFFFFF; @@ -1077,7 +1074,7 @@ static void LoadMenus() // Hide all thumbs main menu item hMainHideAllThumbs = CreateServiceFunction( sModule "/MainHideAllThumbs", OnMainMenu_HideAll ); ZeroMemory( &mi, sizeof( mi )); - + mi.cbSize = sizeof( mi ); mi.position = 0xFFFFF; mi.flags = CMIF_TCHAR; @@ -1090,7 +1087,7 @@ static void LoadMenus() HOTKEYDESC hkd = {0}; hkd.cbSize = sizeof(hkd); hkd.pszSection = "Floating Contacts"; - + hkd.pszName = sModule "/MainHideAllThumbs"; hkd.pszDescription = LPGEN("Show/Hide all thumbs"); hkd.pszService = sModule "/MainHideAllThumbs"; @@ -1110,7 +1107,7 @@ static void LoadContact( HANDLE hContact ) TCHAR *ptName = NULL; ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact ); int nX, nY; - + if ( hContact == NULL ) return; @@ -1124,7 +1121,7 @@ static void LoadContact( HANDLE hContact ) { nX = DB_POS_GETX( dwPos ); nY = DB_POS_GETY( dwPos ); - + CreateThumbWnd( ptName, hContact, nX, nY ); pThumb->PositionThumb( (short)nX, (short)nY ); } @@ -1136,30 +1133,30 @@ BOOL HideOnFullScreen() { BOOL bFullscreen = FALSE; HWND hWnd = 0; - + if ( fcOpt.bHideWhenFullscreen ) { int w = GetSystemMetrics(SM_CXSCREEN); int h = GetSystemMetrics(SM_CYSCREEN); - + hWnd = GetForegroundWindow(); while (GetWindowLongPtr(hWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) { RECT WindowRect; GetWindowRect(hWnd, &WindowRect); - + if ( (w == (WindowRect.right - WindowRect.left)) && (h == (WindowRect.bottom - WindowRect.top))) - { + { bFullscreen = TRUE; break; } - + hWnd = GetNextWindow( hWnd, GW_HWNDNEXT ); } } - + return bFullscreen && fcOpt.bHideWhenFullscreen; } @@ -1208,12 +1205,12 @@ static VOID CALLBACK ToTopTimerProc ( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DW { for (int i = 0; i < thumbList.getCount(); ++i) { - SetWindowPos(thumbList[i]->hwnd, - HWND_TOPMOST, - 0, - 0, - 0, - 0, + SetWindowPos(thumbList[i]->hwnd, + HWND_TOPMOST, + 0, + 0, + 0, + 0, SWP_NOSIZE | SWP_NOMOVE | /*SWP_NOZORDER |*/ SWP_NOACTIVATE); } } @@ -1238,7 +1235,7 @@ void HideThumbsOnShowCList() static LRESULT __stdcall newMirandaWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { - if ( uMsg == WM_WINDOWPOSCHANGED) { + if ( uMsg == WM_WINDOWPOSCHANGED) { WINDOWPOS *wp = (WINDOWPOS *)lParam; if (wp->flags&SWP_HIDEWINDOW) { bIsCListShow = FALSE; @@ -1270,4 +1267,4 @@ static LRESULT __stdcall newMirandaWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, } } return( CallWindowProc(oldMirandaWndProc, hwnd, uMsg, wParam, lParam)); -} +} diff --git a/plugins/Folders/folders.cpp b/plugins/Folders/folders.cpp index c7e51d486f..88fe12cf77 100644 --- a/plugins/Folders/folders.cpp +++ b/plugins/Folders/folders.cpp @@ -30,7 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char ModuleName[] = "Folders"; HINSTANCE hInstance; int hLangpack; -struct MM_INTERFACE mmi; CFoldersList &lstRegisteredFolders = CFoldersList(10); //the list @@ -178,7 +177,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) #endif pluginLink = link; mir_getLP(&pluginInfo); - mir_getMMI(&mmi); Log("%s", "Creating service functions ..."); InitServices(); diff --git a/plugins/Gender/main.cpp b/plugins/Gender/main.cpp index 3df2a909e8..19de3c2bbf 100644 --- a/plugins/Gender/main.cpp +++ b/plugins/Gender/main.cpp @@ -45,7 +45,6 @@ byte bDrawNoGenderIcon = 0; // enable icon when no info? byte bContactMenuItems = 1; // do we need a contact menu items? byte bMetaAvail = 0; // metacontacts installed? int hLangpack; -struct MM_INTERFACE mmi; extern int onOptInitialise(WPARAM wParam, LPARAM lParam); @@ -433,7 +432,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; mir_getLP(&pluginInfo); - mir_getMMI(&mmi); hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded); hSystemOKToExit = HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit); diff --git a/plugins/HistoryLinkListPlus/linklist.cpp b/plugins/HistoryLinkListPlus/linklist.cpp index 053b80d200..67ac47b439 100644 --- a/plugins/HistoryLinkListPlus/linklist.cpp +++ b/plugins/HistoryLinkListPlus/linklist.cpp @@ -24,7 +24,6 @@ PLUGINLINK *pluginLink; HANDLE hWindowList; HCURSOR splitCursor; int hLangpack; -struct MM_INTERFACE mmi; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -95,8 +94,6 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) RegisterClass(&wndclass); splitCursor = LoadCursor(NULL, IDC_SIZENS); - - mir_getMMI(&mmi); HookEvent(ME_OPT_INITIALISE, InitOptionsDlg); HookEvent(ME_DB_EVENT_ADDED, DBUpdate); diff --git a/plugins/HistorySweeperLight/main.cpp b/plugins/HistorySweeperLight/main.cpp index 9c1e4e8c66..2a55341787 100644 --- a/plugins/HistorySweeperLight/main.cpp +++ b/plugins/HistorySweeperLight/main.cpp @@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE hInst; PLUGINLINK *pluginLink; -struct MM_INTERFACE mmi; static HANDLE hHooks[5]; int hLangpack; @@ -157,8 +156,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; - - mir_getMMI(&mmi); mir_getLP(&pluginInfoEx); hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); diff --git a/plugins/IEView/IEView.cpp b/plugins/IEView/IEView.cpp index 9d698401e7..3b323180ba 100644 --- a/plugins/IEView/IEView.cpp +++ b/plugins/IEView/IEView.cpp @@ -36,7 +36,6 @@ IEView * IEView::list = NULL; CRITICAL_SECTION IEView::mutex; bool IEView::isInited = false; -struct MM_INTERFACE mmi; static LRESULT CALLBACK IEViewServerWindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { diff --git a/plugins/IEView/ieview.vcxproj b/plugins/IEView/ieview.vcxproj index 4ae13a2ab6..18293abefe 100644 --- a/plugins/IEView/ieview.vcxproj +++ b/plugins/IEView/ieview.vcxproj @@ -73,7 +73,7 @@ Disabled ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN64;_DEBUG;_WINDOWS;_USRDLL;IEVIEW_EXPORTS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;IEVIEW_EXPORTS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL diff --git a/plugins/IgnoreState/main.cpp b/plugins/IgnoreState/main.cpp index 014266df77..d6a9f04807 100644 --- a/plugins/IgnoreState/main.cpp +++ b/plugins/IgnoreState/main.cpp @@ -27,7 +27,6 @@ HANDLE hHookExtraIconsRebuild = NULL, hHookExtraIconsApply = NULL, hContactSetti HANDLE hPrebuildContactMenu = NULL; HANDLE hExtraIcon = NULL; int hLangpack; -struct MM_INTERFACE mmi; INT currentFilter = 0; //static int bUseMirandaSettings = 0; @@ -302,9 +301,7 @@ int onContactSettingChanged(WPARAM wParam,LPARAM lParam) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink=link; - mir_getLP(&pluginInfo); - mir_getMMI(&mmi); - + mir_getLP(&pluginInfo); hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded); hSystemOKToExit = HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit); hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged); diff --git a/plugins/Import/main.cpp b/plugins/Import/main.cpp index a80ae522bd..9f82706367 100644 --- a/plugins/Import/main.cpp +++ b/plugins/Import/main.cpp @@ -49,8 +49,6 @@ HINSTANCE hInst; PLUGINLINK *pluginLink; static HWND hwndWizard = NULL; int hLangpack; -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -134,8 +132,6 @@ static int OnExit(WPARAM wParam, LPARAM lParam) extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI( &mmi ); - mir_getUTFI( &utfi ); mir_getLP( &pluginInfo ); hImportService = CreateServiceFunction(IMPORT_SERVICE, ImportCommand); diff --git a/plugins/KeyboardNotify/main.cpp b/plugins/KeyboardNotify/main.cpp index 2280d08c8f..a563a4764b 100644 --- a/plugins/KeyboardNotify/main.cpp +++ b/plugins/KeyboardNotify/main.cpp @@ -227,7 +227,6 @@ HINSTANCE hInst; PLUGINLINK *pluginLink; int hLangpack; -struct MM_INTERFACE mmi; DWORD IDThread = 0; HANDLE hThread = NULL; @@ -1143,9 +1142,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; - mir_getLP(&pluginInfo); - mir_getMMI(&mmi); - + mir_getLP(&pluginInfo); GetWindowsVersion(); OpenKeyboardDevice(); hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); diff --git a/plugins/LangMan/main.cpp b/plugins/LangMan/main.cpp index a1e9b1bd3f..b7a7609150 100644 --- a/plugins/LangMan/main.cpp +++ b/plugins/LangMan/main.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE hInst; PLUGINLINK *pluginLink; -struct MM_INTERFACE mmi; static HANDLE hHookModulesLoaded; int hLangpack; @@ -116,7 +115,6 @@ __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; mir_getLP( &pluginInfo ); - mir_getMMI( &mmi ); /* existance of MS_SYSTEM_GETVERSION and MS_LANGPACK_TRANSLATESTRING * is checked in MirandaPluginInfo(). diff --git a/plugins/ListeningTo/listeningto.cpp b/plugins/ListeningTo/listeningto.cpp index 265c208c34..a6609486ee 100644 --- a/plugins/ListeningTo/listeningto.cpp +++ b/plugins/ListeningTo/listeningto.cpp @@ -53,8 +53,6 @@ PLUGININFOEX pluginInfo={ HINSTANCE hInst; PLUGINLINK *pluginLink; -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; static std::vector hHooks; static std::vector hServices; @@ -135,9 +133,6 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - - mir_getMMI(&mmi); - mir_getUTFI(&utfi); mir_getLP(&pluginInfo); CHECK_VERSION("Listening To") diff --git a/plugins/MenuItemEx/main.cpp b/plugins/MenuItemEx/main.cpp index 9ae83d10d3..58c3f6cc14 100644 --- a/plugins/MenuItemEx/main.cpp +++ b/plugins/MenuItemEx/main.cpp @@ -20,7 +20,6 @@ const int vf_default = VF_VS|VF_HFL|VF_IGN|VF_CID|VF_SHOWID|VF_RECV|VF_STAT|VF_S PLUGINLINK *pluginLink; MUUID interfaces[] = {MIID_MENUEX, MIID_LAST}; -struct MM_INTERFACE mmi; HINSTANCE hinstance; HANDLE hmenuVis,hmenuOff,hmenuHide,hmenuIgnore,hmenuProto,hmenuAdded,hmenuAuthReq; HANDLE hmenuCopyID,hmenuRecvFiles,hmenuStatusMsg,hmenuCopyIP,hmenuCopyMirVer; @@ -1362,7 +1361,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI( &mmi ); mir_getLP(&pluginInfoEx); hHooks[7] = HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit); return 0; diff --git a/plugins/MetaContacts/meta_main.cpp b/plugins/MetaContacts/meta_main.cpp index fe88307225..d39555c9aa 100644 --- a/plugins/MetaContacts/meta_main.cpp +++ b/plugins/MetaContacts/meta_main.cpp @@ -87,7 +87,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Use VersionNo.h to set the version number, and ensure resource file is not open #include "version.h" -struct MM_INTERFACE mmi; BOOL os_unicode_enabled = FALSE; int hLangpack; @@ -161,8 +160,6 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) DBVARIANT dbv; pluginLink=link; - - mir_getMMI(&mmi); mir_getLP(&pluginInfo); os_unicode_enabled = IsUnicodeOS(); diff --git a/plugins/MirOTR/MirOTR/dllmain.cpp b/plugins/MirOTR/MirOTR/dllmain.cpp index f5b9fb3fe9..dae2e0b959 100644 --- a/plugins/MirOTR/MirOTR/dllmain.cpp +++ b/plugins/MirOTR/MirOTR/dllmain.cpp @@ -8,8 +8,6 @@ HANDLE hEventWindow; HINSTANCE hInst; PLUGINLINK *pluginLink; -MM_INTERFACE mmi; -UTF8_INTERFACE utfi; int hLangpack; char* g_metaproto; @@ -136,8 +134,6 @@ DLLFUNC int Load(PLUGINLINK *link) DEBUGOUT_T("LOAD MIROTR") pluginLink=link; mir_getLP( &pluginInfo ); - mir_getMMI(&mmi); - mir_getUTFI(&utfi); /* for timezones mir_getTMI(&tmi); */ diff --git a/plugins/MirOTR/MirOTR/otr.cpp b/plugins/MirOTR/MirOTR/otr.cpp index dfc5575fa4..380bc891c3 100644 --- a/plugins/MirOTR/MirOTR/otr.cpp +++ b/plugins/MirOTR/MirOTR/otr.cpp @@ -163,7 +163,7 @@ extern "C" { TCHAR* title_t = mir_utf8decodeT(title); TCHAR *notify = TranslateT(LANG_OTR_NOTIFY); - int len = _tcslen(uname) + _tcslen(title_t) + _tcslen(notify); + size_t len = _tcslen(uname) + _tcslen(title_t) + _tcslen(notify); TCHAR *buff1 = new TCHAR[len]; mir_sntprintf(buff1, len, notify, TranslateTS(title_t), uname); mir_free(title_t); diff --git a/plugins/MirOTR/MirOTR/svcs_proto.cpp b/plugins/MirOTR/MirOTR/svcs_proto.cpp index 1124d5c797..d20ef4d896 100644 --- a/plugins/MirOTR/MirOTR/svcs_proto.cpp +++ b/plugins/MirOTR/MirOTR/svcs_proto.cpp @@ -352,7 +352,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){ } if (options.prefix_messages) { - DWORD len = (strlen(options.prefix)+strlen(newmessage)+1)*sizeof(char); + size_t len = (strlen(options.prefix)+strlen(newmessage)+1)*sizeof(char); premsg = (char*)mir_alloc( len ); memset(premsg, 0, len); strcpy(premsg, options.prefix); diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/md5.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/md5.c index 899dce89ad..aaf02a8f14 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/md5.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/md5.c @@ -52,7 +52,7 @@ typedef struct { static void -md5_init( void *context ) +mir_md5_init( void *context ) { MD5_CONTEXT *ctx = context; @@ -350,6 +350,6 @@ static gcry_md_oid_spec_t oid_spec_md5[] = gcry_md_spec_t _gcry_digest_spec_md5 = { "MD5", asn, DIM (asn), oid_spec_md5, 16, - md5_init, md5_write, md5_final, md5_read, + mir_md5_init, md5_write, md5_final, md5_read, sizeof (MD5_CONTEXT) }; diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/sha1.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/sha1.c index 8862c64b0a..67cbaff3b3 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/sha1.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/sha1.c @@ -66,7 +66,7 @@ typedef struct static void -sha1_init (void *context) +mir_sha1_init (void *context) { SHA1_CONTEXT *hd = context; @@ -367,7 +367,7 @@ _gcry_sha1_hash_buffer (void *outbuf, const void *buffer, size_t length) { SHA1_CONTEXT hd; - sha1_init (&hd); + mir_sha1_init (&hd); sha1_write (&hd, buffer, length); sha1_final (&hd); memcpy (outbuf, hd.buf, 20); @@ -469,7 +469,7 @@ static gcry_md_oid_spec_t oid_spec_sha1[] = gcry_md_spec_t _gcry_digest_spec_sha1 = { "SHA1", asn, DIM (asn), oid_spec_sha1, 20, - sha1_init, sha1_write, sha1_final, sha1_read, + mir_sha1_init, sha1_write, sha1_final, sha1_read, sizeof (SHA1_CONTEXT) }; md_extra_spec_t _gcry_digest_extraspec_sha1 = diff --git a/plugins/ModernOpt/main.cpp b/plugins/ModernOpt/main.cpp index 6cdb0d671b..760a9b16dd 100644 --- a/plugins/ModernOpt/main.cpp +++ b/plugins/ModernOpt/main.cpp @@ -3,8 +3,6 @@ PLUGINLINK *pluginLink; HINSTANCE hInst; -MM_INTERFACE mmi; -LIST_INTERFACE li; int hLangpack; PLUGININFOEX pluginInfoEx = { @@ -43,8 +41,6 @@ int LoadModernOptsModule(); extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI( &mmi ); - mir_getLI( &li ); mir_getLP(&pluginInfoEx); LoadModernOptsModule(); diff --git a/plugins/NewAwaySysMod/AwaySys.cpp b/plugins/NewAwaySysMod/AwaySys.cpp index c7fd8b5b8a..2671a3caf7 100644 --- a/plugins/NewAwaySysMod/AwaySys.cpp +++ b/plugins/NewAwaySysMod/AwaySys.cpp @@ -49,7 +49,6 @@ HINSTANCE g_hInstance; PLUGINLINK *pluginLink; -MM_INTERFACE mmi; int hLangpack = 0; TMyArray hHooks, hServices; HANDLE g_hContactMenuItem = NULL, g_hReadStatMenuItem = NULL, /*g_hTopToolbarbutton = NULL, */g_hToggleSOEMenuItem = NULL, g_hToggleSOEContactMenuItem = NULL, g_hAutoreplyOnContactMenuItem = NULL, g_hAutoreplyOffContactMenuItem = NULL, g_hAutoreplyUseDefaultContactMenuItem = NULL; @@ -1004,7 +1003,6 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI( &mmi ); mir_getLP( &pluginInfo ); hHooks.AddElem(HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded)); diff --git a/plugins/NewEventNotify/main.c b/plugins/NewEventNotify/main.c index c6240c0402..e355f7adce 100644 --- a/plugins/NewEventNotify/main.c +++ b/plugins/NewEventNotify/main.c @@ -48,7 +48,6 @@ extern PLUGIN_DATA* PopUpList[20]; //--------------------------- //---Some global variables for the plugin -struct MM_INTERFACE mmi; HINSTANCE hInst; PLUGIN_OPTIONS pluginOptions; @@ -221,10 +220,7 @@ int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; hHookedInit = HookEvent(ME_SYSTEM_MODULESLOADED, HookedInit); - hHookedOpt = HookEvent(ME_OPT_INITIALISE, HookedOptions); - - mir_getMMI(&mmi); - mir_getLP(&pluginInfo); + hHookedOpt = HookEvent(ME_OPT_INITIALISE, HookedOptions); mir_getLP(&pluginInfo); InitI18N(); diff --git a/plugins/NewEventNotify/menuitem.c b/plugins/NewEventNotify/menuitem.c index f6d471b636..eac66a59aa 100644 --- a/plugins/NewEventNotify/menuitem.c +++ b/plugins/NewEventNotify/menuitem.c @@ -30,14 +30,13 @@ CLISTMENUITEM menuitem; HANDLE hMenuitemNotify; BOOL bNotify; -static int MenuitemNotifyCmd(WPARAM wParam,LPARAM lParam) +static INT_PTR MenuitemNotifyCmd(WPARAM wParam,LPARAM lParam) { bNotify = !bNotify; MenuitemUpdate(bNotify); //write changes to options->bDisable and into database Opt_DisableNEN(!bNotify); - return 0; } diff --git a/plugins/NewEventNotify/options.c b/plugins/NewEventNotify/options.c index 401ab0941d..24ecc24485 100644 --- a/plugins/NewEventNotify/options.c +++ b/plugins/NewEventNotify/options.c @@ -145,7 +145,7 @@ static void UpdateOptionsDlgItemsState(HWND hWnd) EnableDlgItem(hWnd, IDC_DELAY_OTHERS, options->iDelayOthers != -1); } -static BOOL CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { diff --git a/plugins/NewXstatusNotify/common.h b/plugins/NewXstatusNotify/common.h index 3cbb588379..343ee4fe58 100644 --- a/plugins/NewXstatusNotify/common.h +++ b/plugins/NewXstatusNotify/common.h @@ -106,8 +106,6 @@ #define JS_PARSE_XMPP_URI "/ParseXmppURI" -extern LIST_INTERFACE li; - typedef struct tagSTATUS { int ID; @@ -123,7 +121,7 @@ typedef struct tagSTATUS COLORREF colorText; } STATUS; -typedef struct tagPLUGINDATA +typedef struct tagPLUGINDATA { WORD newStatus; WORD oldStatus; diff --git a/plugins/NewXstatusNotify/main.cpp b/plugins/NewXstatusNotify/main.cpp index e2eef82117..2d336b291e 100644 --- a/plugins/NewXstatusNotify/main.cpp +++ b/plugins/NewXstatusNotify/main.cpp @@ -30,10 +30,6 @@ HINSTANCE hInst; PLUGINLINK *pluginLink; -MM_INTERFACE mmi = {0}; -UTF8_INTERFACE utfi = {0}; -LIST_INTERFACE li = {0}; - LIST eventList( 10 ); LIST xstatusList( 10 ); @@ -86,7 +82,7 @@ BYTE GetGender(HANDLE hContact) char *szProto =(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if (szProto) { - switch (DBGetContactSettingByte(hContact, szProto, "Gender", 0)) + switch (DBGetContactSettingByte(hContact, szProto, "Gender", 0)) { case 'M': case 'm': return GENDER_MALE; @@ -171,17 +167,17 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) if (strstr(cws->szSetting, "/mood/")) { - type = TYPE_JABBER_MOOD; + type = TYPE_JABBER_MOOD; szSetting = "LastJabberMood"; } else { - type = TYPE_JABBER_ACTIVITY; + type = TYPE_JABBER_ACTIVITY; szSetting = "LastJabberActivity"; } - if (strstr(cws->szSetting, "title")) - { + if (strstr(cws->szSetting, "title")) + { TCHAR *stzValue = db2t(&cws->value); if (stzValue) { @@ -201,7 +197,7 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) } AddXSC(xsc); - if (xsc != NULL) + if (xsc != NULL) { ExtraStatusChanged(xsc); FreeXSC(xsc); @@ -218,8 +214,8 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) else xsc = NewXSC(hContact, szProto, type, NOTIFY_NEW_MESSAGE, NULL, stzValue); } - - if (xsc != NULL) + + if (xsc != NULL) { ExtraStatusChanged(xsc); FreeXSC(xsc); @@ -255,7 +251,7 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) } AddXSC(xsc); - if (xsc != NULL) + if (xsc != NULL) { ExtraStatusChanged(xsc); FreeXSC(xsc); @@ -268,7 +264,7 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) TCHAR *stzValue = db2t(&cws->value); xsc = FindXSC(hContact); - if (xsc) + if (xsc) { if (xsc->action == NOTIFY_NEW_XSTATUS) xsc->stzText = stzValue; @@ -278,7 +274,7 @@ int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) xsc = NewXSC(hContact, szProto, TYPE_ICQ_XSTATUS, NOTIFY_NEW_MESSAGE, NULL, stzValue); AddXSC(xsc); } - if (xsc != NULL) + if (xsc != NULL) { ExtraStatusChanged(xsc); FreeXSC(xsc); @@ -417,7 +413,7 @@ static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new) return ret; } -BOOL FreeSmiStr(STATUSMSGINFO *smi) +BOOL FreeSmiStr(STATUSMSGINFO *smi) { mir_free(smi->newstatusmsg); mir_free(smi->oldstatusmsg); @@ -455,7 +451,7 @@ TCHAR* AddCR(const TCHAR *statusmsg) { if(lstrlen(tmp) + len - i + 1 < 1024){ tmp = lstrcat(tmp, statusmsg + i); } - + return tmp; } @@ -482,7 +478,7 @@ TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt) { switch (tmplt[i]) { case 'n': - if (n->compare == 2 || _tcscmp(n->newstatusmsg, TranslateT("")) == 0) + if (n->compare == 2 || _tcscmp(n->newstatusmsg, TranslateT("")) == 0) lstrcpyn(tmp, TranslateT(""), SIZEOF(tmp)); else { TCHAR *_tmp = AddCR(n->newstatusmsg); @@ -491,7 +487,7 @@ TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt) { } break; case 'o': - if (n->oldstatusmsg == NULL || n->oldstatusmsg[0] == _T('\0') || _tcscmp(n->oldstatusmsg, TranslateT("")) == 0) + if (n->oldstatusmsg == NULL || n->oldstatusmsg[0] == _T('\0') || _tcscmp(n->oldstatusmsg, TranslateT("")) == 0) lstrcpyn(tmp, TranslateT(""), SIZEOF(tmp)); else { TCHAR *_tmp = AddCR(n->oldstatusmsg); @@ -548,16 +544,16 @@ TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt) { } } } - + return str; } int ProcessStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) { - if (strcmp(cws->szSetting, "Status") == 0) + if (strcmp(cws->szSetting, "Status") == 0) { WORD newStatus = cws->value.wVal; - if (newStatus < ID_STATUS_MIN || newStatus > ID_STATUS_MAX) + if (newStatus < ID_STATUS_MIN || newStatus > ID_STATUS_MAX) return 0; DBVARIANT dbv; @@ -569,14 +565,14 @@ int ProcessStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) } WORD oldStatus = DBGetContactSettingRangedWord(hContact, "UserOnline", "OldStatus", ID_STATUS_OFFLINE, ID_STATUS_MIN, ID_STATUS_MAX); - if (oldStatus == newStatus) + if (oldStatus == newStatus) return 0; //If we get here, the two stauses differ, so we can proceed. DBWriteContactSettingWord(hContact, "UserOnline", "OldStatus", newStatus); //If *Miranda* ignores the UserOnline event, exit! - if (CallService(MS_IGNORE_ISIGNORED, (WPARAM)hContact, IGNOREEVENT_USERONLINE)) + if (CallService(MS_IGNORE_ISIGNORED, (WPARAM)hContact, IGNOREEVENT_USERONLINE)) return 0; //If we get here, we have to notify the Hooks. @@ -673,7 +669,7 @@ int ProcessStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) str = GetStr(&smi, dbVar.ptszVal); } mir_free(protoname); - + ppd.lchContact = smi.hContact; ppd.lchIcon = LoadSkinnedProtoIcon(smi.proto, DBGetContactSettingWord(smi.hContact, smi.proto, "Status", ID_STATUS_ONLINE)); lstrcpyn(ppd.lptzContactName, smi.cust, MAX_CONTACTNAME); @@ -694,7 +690,7 @@ int ProcessStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) } ppd.PluginWindowProc = (WNDPROC)PopupDlgProc; ppd.PluginData = NULL; - ppd.iSeconds = opt.PopupTimeout; + ppd.iSeconds = opt.PopupTimeout; PUAddPopUpT(&ppd); mir_free(str); } @@ -711,11 +707,11 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; HANDLE hContact = (HANDLE)wParam; - if (hContact == NULL) + if (hContact == NULL) return 0; char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - if (szProto == NULL) + if (szProto == NULL) return 0; if (DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) @@ -731,9 +727,9 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) int StatusModeChanged(WPARAM wParam, LPARAM lParam) { char *szProto = (char *)lParam; - if (opt.AutoDisable && (!opt.OnlyGlobalChanges || szProto == NULL)) + if (opt.AutoDisable && (!opt.OnlyGlobalChanges || szProto == NULL)) { - if (opt.DisablePopupGlobally && ServiceExists(MS_POPUP_QUERY)) + if (opt.DisablePopupGlobally && ServiceExists(MS_POPUP_QUERY)) { char szSetting[12]; wsprintfA(szSetting, "p%d", wParam); @@ -744,25 +740,25 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam) BYTE hlpPopupStatus = (BYTE)CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0); opt.PopupAutoDisabled = hlpDisablePopup; - if (hlpDisablePopup) - { + if (hlpDisablePopup) + { DBWriteContactSettingByte(0, MODULE, "OldPopupStatus", hlpPopupStatus); CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0); - } + } else { - if (hlpPopupStatus == FALSE) + if (hlpPopupStatus == FALSE) { if (DBGetContactSettingByte(0, MODULE, "OldPopupStatus", TRUE) == TRUE) CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS, 0); else CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0); } - } + } } } - if (opt.DisableSoundGlobally) + if (opt.DisableSoundGlobally) { char szSetting[12]; wsprintfA(szSetting, "s%d", wParam); @@ -773,16 +769,16 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam) BYTE hlpUseSound = DBGetContactSettingByte(NULL, "Skin", "UseSound", 1); opt.SoundAutoDisabled = hlpDisableSound; - if (hlpDisableSound) - { + if (hlpDisableSound) + { DBWriteContactSettingByte(0, MODULE, "OldUseSound", hlpUseSound); - DBWriteContactSettingByte(0, "Skin", "UseSound", FALSE); - } + DBWriteContactSettingByte(0, "Skin", "UseSound", FALSE); + } else { if (hlpUseSound == FALSE) DBWriteContactSettingByte(0, "Skin", "UseSound", DBGetContactSettingByte(0, MODULE, "OldUseSound", 1)); - } + } } } } @@ -793,7 +789,7 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam) void ShowStatusChangePopup(HANDLE hContact, char *szProto, WORD oldStatus, WORD newStatus) { TCHAR stzStatusText[MAX_SECONDLINE] = {0}; - WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, (WPARAM)0, (LPARAM)0); + WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, (WPARAM)0, (LPARAM)0); POPUPDATAT ppd = {0}; ppd.lchContact = hContact; @@ -816,16 +812,16 @@ void ShowStatusChangePopup(HANDLE hContact, char *szProto, WORD oldStatus, WORD { if (opt.UseAlternativeText) { - switch (GetGender(hContact)) + switch (GetGender(hContact)) { case GENDER_MALE: - _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzMStatusText, MAX_STATUSTEXT); + _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzMStatusText, MAX_STATUSTEXT); break; case GENDER_FEMALE: - _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzFStatusText, MAX_STATUSTEXT); + _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzFStatusText, MAX_STATUSTEXT); break; case GENDER_UNSPECIFIED: - _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzUStatusText, MAX_STATUSTEXT); + _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzUStatusText, MAX_STATUSTEXT); break; } } @@ -834,7 +830,7 @@ void ShowStatusChangePopup(HANDLE hContact, char *szProto, WORD oldStatus, WORD _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzStandardText, MAX_STATUSTEXT); } - if (opt.ShowPreviousStatus) + if (opt.ShowPreviousStatus) { TCHAR buff[MAX_STATUSTEXT]; wsprintf(buff, TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(oldStatus)].lpzStandardText); @@ -842,8 +838,8 @@ void ShowStatusChangePopup(HANDLE hContact, char *szProto, WORD oldStatus, WORD } } - if (opt.ReadAwayMsg && - myStatus != ID_STATUS_INVISIBLE && + if (opt.ReadAwayMsg && + myStatus != ID_STATUS_INVISIBLE && StatusHasAwayMessage(szProto, newStatus)) { DBWriteContactSettingTString(hContact, MODULE, "LastPopupText", stzStatusText); @@ -874,7 +870,7 @@ void ShowStatusChangePopup(HANDLE hContact, char *szProto, WORD oldStatus, WORD pdp->hAwayMsgHook = NULL; pdp->hAwayMsgProcess = NULL; ppd.PluginData = pdp; - ppd.iSeconds = opt.PopupTimeout; + ppd.iSeconds = opt.PopupTimeout; PUAddPopUpT(&ppd); } @@ -906,8 +902,8 @@ void PlayChangeSound(HANDLE hContact, WORD oldStatus, WORD newStatus) { TCHAR stzSoundFile[MAX_PATH] = {0}; if (!DBGetContactSettingTString(hContact, MODULE, "UserFromOffline", &dbv) && - oldStatus == ID_STATUS_OFFLINE) - { + oldStatus == ID_STATUS_OFFLINE) + { _tcscpy(stzSoundFile, dbv.ptszVal); DBFreeVariant(&dbv); } @@ -924,19 +920,19 @@ void PlayChangeSound(HANDLE hContact, WORD oldStatus, WORD newStatus) CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)stzSoundFile, (LPARAM)stzSoundPath); PlaySound(stzSoundPath, NULL, SND_ASYNC | SND_FILENAME | SND_NOSTOP); return; - } + } } char szSoundFile[MAX_PATH] = {0}; - - if (!DBGetContactSettingByte(0, "SkinSoundsOff", "UserFromOffline", 0) && + + if (!DBGetContactSettingByte(0, "SkinSoundsOff", "UserFromOffline", 0) && !DBGetContactSettingString(0,"SkinSounds", "UserFromOffline", &dbv) && oldStatus == ID_STATUS_OFFLINE) - { + { strcpy(szSoundFile, "UserFromOffline"); DBFreeVariant(&dbv); } - else if (!DBGetContactSettingByte(0, "SkinSoundsOff", StatusList[Index(newStatus)].lpzSkinSoundName, 0) && + else if (!DBGetContactSettingByte(0, "SkinSoundsOff", StatusList[Index(newStatus)].lpzSkinSoundName, 0) && !DBGetContactSetting(0, "SkinSounds", StatusList[Index(newStatus)].lpzSkinSoundName, &dbv)) { strcpy(szSoundFile, StatusList[Index(newStatus)].lpzSkinSoundName); @@ -952,54 +948,54 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) WORD oldStatus = LOWORD(lParam); WORD newStatus = HIWORD(lParam); HANDLE hContact = (HANDLE)wParam; - char buff[8], szProto[64], szSubProto[64]; + char buff[8], szProto[64], szSubProto[64]; bool bEnablePopup = true, bEnableSound = true; char *hlpProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); - if (hlpProto == NULL || opt.TempDisabled) + if (hlpProto == NULL || opt.TempDisabled) return 0; strcpy(szProto, hlpProto); - WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, (WPARAM)0, (LPARAM)0); + WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, (WPARAM)0, (LPARAM)0); if (strcmp(szProto, szMetaModuleName) == 0) //this contact is Meta { - HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); strcpy(szSubProto, (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hSubContact,0)); - - if (newStatus == ID_STATUS_OFFLINE) + + if (newStatus == ID_STATUS_OFFLINE) { - // read last online proto for metaconatct if exists, + // read last online proto for metaconatct if exists, // to avoid notifying when meta went offline but default contact's proto still online - DBVARIANT dbv; + DBVARIANT dbv; if (!DBGetContactSettingString(hContact, szProto, "LastOnline", &dbv)) { strcpy(szSubProto, dbv.pszVal); DBFreeVariant(&dbv); - } + } } else DBWriteContactSettingString(hContact, szProto, "LastOnline", szSubProto); - if (!DBGetContactSettingByte(0, MODULE, szSubProto, 1)) - return 0; + if (!DBGetContactSettingByte(0, MODULE, szSubProto, 1)) + return 0; strcpy(szProto, szSubProto); } else { - if (myStatus == ID_STATUS_OFFLINE) + if (myStatus == ID_STATUS_OFFLINE) return 0; } - + if (!opt.FromOffline || oldStatus != ID_STATUS_OFFLINE) // Either it wasn't a change from Offline or we didn't enable that. - { - wsprintfA(buff, "%d", newStatus); - if (DBGetContactSettingByte(0, MODULE, buff, 1) == 0) + { + wsprintfA(buff, "%d", newStatus); + if (DBGetContactSettingByte(0, MODULE, buff, 1) == 0) return 0; // "Notify when a contact changes to one of..." is unchecked } - - if (!opt.HiddenContactsToo && (DBGetContactSettingByte(hContact, "CList", "Hidden", 0) == 1)) + + if (!opt.HiddenContactsToo && (DBGetContactSettingByte(hContact, "CList", "Hidden", 0) == 1)) return 0; // we don't want to be notified if new chatroom comes online @@ -1016,9 +1012,9 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) bEnablePopup = DBGetContactSettingByte(0, MODULE, statusIDp, 1) ? FALSE : TRUE; } - if (bEnablePopup && DBGetContactSettingByte(hContact, MODULE, "EnablePopups", 1) && TimeoutCheck()) + if (bEnablePopup && DBGetContactSettingByte(hContact, MODULE, "EnablePopups", 1) && TimeoutCheck()) ShowStatusChangePopup(hContact, szProto, oldStatus, newStatus); - + if (opt.BlinkIcon) BlinkIcon(hContact, szProto, newStatus); @@ -1029,7 +1025,7 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) PlayChangeSound(hContact, oldStatus, newStatus); } - if (opt.Log) + if (opt.Log) { TCHAR stzName[64], stzStatus[MAX_STATUSTEXT], stzOldStatus[MAX_STATUSTEXT]; TCHAR stzDate[MAX_STATUSTEXT], stzTime[MAX_STATUSTEXT]; @@ -1043,11 +1039,11 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) wsprintf(stzText, TranslateT("%s, %s. %s changed to: %s (was: %s).\r\n"), stzDate, stzTime, stzName, stzStatus, stzOldStatus); LogToFile(stzText); } - + return 0; -} +} -void InitStatusList() +void InitStatusList() { int index = 0; //Online @@ -1200,7 +1196,7 @@ void InitStatusList() void InitUpdaterSupport() { #ifndef _WIN64 - if (ServiceExists(MS_UPDATE_REGISTER)) + if (ServiceExists(MS_UPDATE_REGISTER)) { Update update = {0}; char szVersion[16]; @@ -1229,15 +1225,15 @@ int ProtoAck(WPARAM wParam,LPARAM lParam) WORD oldStatus = (WORD)ack->hProcess; char *szProto = (char *)ack->szModule; - if (oldStatus == newStatus) + if (oldStatus == newStatus) return 0; - if (newStatus == ID_STATUS_OFFLINE) + if (newStatus == ID_STATUS_OFFLINE) { //The protocol switched to offline. Disable the popups for this protocol DBWriteContactSettingByte(NULL, MODULE, szProto, 0); } - else if (oldStatus < ID_STATUS_ONLINE && newStatus >= ID_STATUS_ONLINE) + else if (oldStatus < ID_STATUS_ONLINE && newStatus >= ID_STATUS_ONLINE) { //The protocol changed from a disconnected status to a connected status. //Enable the popups for this protocol. @@ -1248,7 +1244,7 @@ int ProtoAck(WPARAM wParam,LPARAM lParam) return 0; } -INT_PTR EnableDisableMenuCommand(WPARAM wParam, LPARAM lParam) +INT_PTR EnableDisableMenuCommand(WPARAM wParam, LPARAM lParam) { opt.TempDisabled = !opt.TempDisabled; DBWriteContactSettingByte(0, MODULE, "TempDisable", opt.TempDisabled); @@ -1261,18 +1257,18 @@ INT_PTR EnableDisableMenuCommand(WPARAM wParam, LPARAM lParam) mi.ptszName = _T("Enable status notification"); mi.icolibItem = GetIconHandle(ICO_NOTIFICATION_OFF); } - else + else { mi.ptszName = _T("Disable status notification"); mi.icolibItem = GetIconHandle(ICO_NOTIFICATION_ON); } - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hEnableDisableMenu, (LPARAM)&mi); + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hEnableDisableMenu, (LPARAM)&mi); CallService(MS_TB_SETBUTTONSTATEBYID, (WPARAM)"StatusNotificationToggle", opt.TempDisabled ? TBST_PUSHED : TBST_RELEASED); return 0; } -void InitMainMenuItem() +void InitMainMenuItem() { CLISTMENUITEM mi = { 0 }; mi.cbSize = sizeof(mi); @@ -1284,7 +1280,7 @@ void InitMainMenuItem() opt.TempDisabled = !opt.TempDisabled; EnableDisableMenuCommand(0, 0); - hServiceMenu = (HANDLE)CreateServiceFunction(MS_STATUSCHANGE_MENUCOMMAND, EnableDisableMenuCommand); + hServiceMenu = (HANDLE)CreateServiceFunction(MS_STATUSCHANGE_MENUCOMMAND, EnableDisableMenuCommand); } struct _tag_iconList @@ -1313,7 +1309,7 @@ void InitIcolib() GetModuleFileNameA(hInst, szFile, MAX_PATH); - for (int i = 0; i < SIZEOF(iconList); i++) + for (int i = 0; i < SIZEOF(iconList); i++) { mir_snprintf(szSettingName, sizeof(szSettingName), "%s_%s", MODULE, iconList[i].szName); sid.pszDescription = Translate(iconList[i].szDescr); @@ -1324,7 +1320,7 @@ void InitIcolib() void InitSound() { - for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) + for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) SkinAddNewSoundEx(StatusList[Index(i)].lpzSkinSoundName, LPGEN("Status Notify"), StatusList[Index(i)].lpzSkinSoundDesc); SkinAddNewSoundEx("UserFromOffline", LPGEN("Status Notify"), LPGEN("User: from offline (has priority!)")); @@ -1351,7 +1347,7 @@ void InitTopToolbar() } } -int ModulesLoaded(WPARAM wParam, LPARAM lParam) +int ModulesLoaded(WPARAM wParam, LPARAM lParam) { InitUpdaterSupport(); InitMainMenuItem(); @@ -1364,9 +1360,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) int count = 0; PROTOACCOUNT **accounts = NULL; CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)&count, (LPARAM)&accounts); - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { - if (IsAccountEnabled(accounts[i])) + if (IsAccountEnabled(accounts[i])) DBWriteContactSettingByte(NULL, MODULE, accounts[i]->szModuleName, 0); } @@ -1379,12 +1375,6 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - - if (mir_getMMI(&mmi) || mir_getLI(&li) || mir_getUTFI(&utfi)) - { - MessageBox(NULL, TranslateT("Cannot obtain required interfaces!\nPlugin will not be loaded until you upgrade Miranda IM to the newest version."), TranslateT("NewXstatusNotify"), MB_OK | MB_ICONSTOP); - return 1; - } mir_getLP(&pluginInfoEx); //"Service" Hook, used when the DB settings change: we'll monitor the "status" setting. diff --git a/plugins/NewXstatusNotify/options.cpp b/plugins/NewXstatusNotify/options.cpp index 5fc13a53ad..808092d498 100644 --- a/plugins/NewXstatusNotify/options.cpp +++ b/plugins/NewXstatusNotify/options.cpp @@ -29,7 +29,7 @@ OPTIONS opt = {0}; TEMPLATES templates = {0}; BOOL UpdateListFlag = FALSE; -SortedList *ProtoTemplates; +LIST ProtoTemplates(10); int LastItem = 0; extern HINSTANCE hInst; @@ -114,16 +114,13 @@ void SaveTemplates() DBWriteContactSettingTString(0, MODULE, "TLogOpening", templates.LogOpening); DBWriteContactSettingByte(0, MODULE, "TPopupFlags", templates.PopupFlags); DBWriteContactSettingByte(0, MODULE, "TLogFlags", templates.LogFlags); - if(ProtoTemplates!=NULL) - { - for (int i = 0; i < ProtoTemplates->realCount; i++) - { - PROTOTEMPLATE *prototemplate = (PROTOTEMPLATE *)ProtoTemplates->items[i]; - TCHAR str[MAX_PATH]; - mir_sntprintf(str, SIZEOF(str), _T("%s_TSMChange"), prototemplate->ProtoName); - char *szstr = mir_t2a(str); - DBWriteContactSettingTString(0, MODULE, szstr, prototemplate->ProtoTemplate); - } + + for (int i = 0; i < ProtoTemplates.getCount(); i++) { + PROTOTEMPLATE *prototemplate = ProtoTemplates[i]; + TCHAR str[MAX_PATH]; + mir_sntprintf(str, SIZEOF(str), _T("%s_TSMChange"), prototemplate->ProtoName); + char *szstr = mir_t2a(str); + DBWriteContactSettingTString(0, MODULE, szstr, prototemplate->ProtoTemplate); } } @@ -712,11 +709,10 @@ bool IsSuitableProto( PROTOACCOUNT* pa ) INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) - { - case WM_INITDIALOG: + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); { - TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_ONCONNECT, opt.PopupOnConnect); CheckDlgButton(hwndDlg, IDC_PUIGNOREREMOVE, opt.IgnoreEmpty); @@ -748,9 +744,8 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int count; PROTOACCOUNT** protos; ProtoEnumAccounts( &count, &protos ); - ProtoTemplates = li.List_Create(0, 10); - for(int i=0;iProtoTemplate, TranslateT(DEFAULT_POPUP_STATUSMESSAGE), SIZEOF(prototemplate->ProtoTemplate)); } - else - { - _tcsncpy(prototemplate->ProtoTemplate, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplate)); - } + else _tcsncpy(prototemplate->ProtoTemplate, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplate)); + mir_free(szprotoname); ListView_InsertItem(hList,&lvItem); - li.List_Insert(ProtoTemplates, prototemplate, ProtoTemplates->realCount); + ProtoTemplates.insert(prototemplate, ProtoTemplates.getCount()); char dbSetting[128]; mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", protos[i]->szModuleName); @@ -783,106 +775,94 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA lvItem.iItem++; } UpdateListFlag = FALSE; - return TRUE; } - case WM_COMMAND: - { - switch (HIWORD(wParam)) - { - case BN_CLICKED: - { - switch (LOWORD(wParam)) - { - case IDC_BT_VARIABLES: - MessageBox(0, VARIABLES_SM_HELP_TEXT, TranslateT("Variables"), MB_OK | MB_ICONINFORMATION); - break; - - case IDC_BT_RESET: - if (ResetTemplatesToDefault(hwndDlg) == IDYES) break; - else return FALSE; - } + return TRUE; + + case WM_COMMAND: + switch (HIWORD(wParam)) { + case BN_CLICKED: + switch (LOWORD(wParam)) { + case IDC_BT_VARIABLES: + MessageBox(0, VARIABLES_SM_HELP_TEXT, TranslateT("Variables"), MB_OK | MB_ICONINFORMATION); + break; + + case IDC_BT_RESET: + if (ResetTemplatesToDefault(hwndDlg) == IDYES) break; + else return FALSE; + } - if (LOWORD(wParam) != IDC_BT_VARIABLES) - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + if (LOWORD(wParam) != IDC_BT_VARIABLES) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } - case EN_CHANGE: - { - if ((HWND)lParam == GetFocus()) - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } + break; - } - return TRUE; + case EN_CHANGE: + if ((HWND)lParam == GetFocus()) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; } - case WM_NOTIFY: - { - if (((NMHDR*)lParam)->idFrom == IDC_PROTOCOLLIST) { - switch(((NMHDR*)lParam)->code) { - case LVN_ITEMCHANGED: + return TRUE; + + case WM_NOTIFY: + if (((NMHDR*)lParam)->idFrom == IDC_PROTOCOLLIST) { + switch(((NMHDR*)lParam)->code) { + case LVN_ITEMCHANGED: + { + NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; + if (nmlv->uNewState == 3 && !UpdateListFlag) { - NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; - if (nmlv->uNewState == 3 && !UpdateListFlag) - { - HWND hList = GetDlgItem(hwndDlg,IDC_PROTOCOLLIST); - PROTOTEMPLATE *prototemplate; - if (ListView_GetHotItem(hList) != ListView_GetSelectionMark(hList)) - { - prototemplate = (PROTOTEMPLATE *)ProtoTemplates->items[ListView_GetSelectionMark(hList)]; - GetDlgItemText(hwndDlg, IDC_POPUPTEXT, prototemplate->ProtoTemplate, MAX_PATH); - li.List_Remove(ProtoTemplates, ListView_GetSelectionMark(hList)); - li.List_Insert(ProtoTemplates, prototemplate, ListView_GetSelectionMark(hList)); + HWND hList = GetDlgItem(hwndDlg,IDC_PROTOCOLLIST); + PROTOTEMPLATE *prototemplate; + if (ListView_GetHotItem(hList) != ListView_GetSelectionMark(hList)) { + prototemplate = ProtoTemplates[ListView_GetSelectionMark(hList)]; + GetDlgItemText(hwndDlg, IDC_POPUPTEXT, prototemplate->ProtoTemplate, MAX_PATH); + ProtoTemplates.remove( ListView_GetSelectionMark(hList)); + ProtoTemplates.insert(prototemplate, ListView_GetSelectionMark(hList)); - } - LastItem = ListView_GetHotItem(hList); - prototemplate = (PROTOTEMPLATE *)ProtoTemplates->items[LastItem]; - SetDlgItemText(hwndDlg, IDC_POPUPTEXT, prototemplate->ProtoTemplate); } - if ((nmlv->uNewState^nmlv->uOldState)&LVIS_STATEIMAGEMASK && !UpdateListFlag) - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + LastItem = ListView_GetHotItem(hList); + prototemplate = ProtoTemplates[LastItem]; + SetDlgItemText(hwndDlg, IDC_POPUPTEXT, prototemplate->ProtoTemplate); } - break; - } } - if (((LPNMHDR)lParam)->code == PSN_APPLY ) - { + if ((nmlv->uNewState^nmlv->uOldState)&LVIS_STATEIMAGEMASK && !UpdateListFlag) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + break; + } + } - opt.IgnoreEmpty = IsDlgButtonChecked(hwndDlg, IDC_PUIGNOREREMOVE); - opt.PopupOnConnect = IsDlgButtonChecked(hwndDlg, IDC_ONCONNECT); + if (((LPNMHDR)lParam)->code == PSN_APPLY ) { + opt.IgnoreEmpty = IsDlgButtonChecked(hwndDlg, IDC_PUIGNOREREMOVE); + opt.PopupOnConnect = IsDlgButtonChecked(hwndDlg, IDC_ONCONNECT); - // Templates - PROTOTEMPLATE *prototemplate = (PROTOTEMPLATE *)ProtoTemplates->items[LastItem]; - GetDlgItemText(hwndDlg, IDC_POPUPTEXT, prototemplate->ProtoTemplate, MAX_PATH); - li.List_Remove(ProtoTemplates, LastItem); - li.List_Insert(ProtoTemplates, prototemplate, LastItem); + // Templates + PROTOTEMPLATE *prototemplate = ProtoTemplates[LastItem]; + GetDlgItemText(hwndDlg, IDC_POPUPTEXT, prototemplate->ProtoTemplate, MAX_PATH); + ProtoTemplates.remove(LastItem); + ProtoTemplates.insert(prototemplate, LastItem); + + // Save options to db + SaveOptions(); + SaveTemplates(); + HWND hList = GetDlgItem(hwndDlg,IDC_PROTOCOLLIST); + LVITEM lvItem = {0}; + lvItem.mask=LVIF_PARAM; + for (int i=0;inext) { if (!strcmp((char *) wParam,n->item.ProtocolName)) { return n->item.ShowContactMenu(lParam != 0); - } + } } return 0; } @@ -53,7 +51,7 @@ INT_PTR NudgeShowMenu(WPARAM wParam,LPARAM lParam) INT_PTR NudgeSend(WPARAM wParam,LPARAM lParam) { - char *protoName = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); + char *protoName = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); int diff = time(NULL) - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastSent", time(NULL)-30); if(diff < GlobalNudge.sendTimeSec) @@ -68,8 +66,8 @@ INT_PTR NudgeSend(WPARAM wParam,LPARAM lParam) if (!strcmp(protoName,n->item.ProtocolName)) { Nudge_ShowPopup(n->item, (HANDLE) wParam, msg); - } - } + } + } } else { @@ -77,7 +75,7 @@ INT_PTR NudgeSend(WPARAM wParam,LPARAM lParam) } return 0; } - + DBWriteContactSettingDword((HANDLE) wParam, "Nudge", "LastSent", time(NULL)); if(GlobalNudge.useByProtocol) @@ -91,7 +89,7 @@ INT_PTR NudgeSend(WPARAM wParam,LPARAM lParam) // Nudge_ShowPopup(n->item, (HANDLE) wParam, n->item.senText); if(n->item.showStatus) Nudge_SentStatus(n->item, (HANDLE) wParam); - } + } } } else @@ -115,7 +113,7 @@ void OpenContactList() int NudgeRecieved(WPARAM wParam,LPARAM lParam) { - + char *protoName = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); DWORD currentTimestamp = time(NULL); @@ -123,7 +121,7 @@ int NudgeRecieved(WPARAM wParam,LPARAM lParam) int diff = currentTimestamp - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived", currentTimestamp-30); int diff2 = nudgeSentTimestamp - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived2", nudgeSentTimestamp-30); - + if(diff >= GlobalNudge.recvTimeSec) DBWriteContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived", currentTimestamp); if(diff2 >= GlobalNudge.recvTimeSec) @@ -135,7 +133,7 @@ int NudgeRecieved(WPARAM wParam,LPARAM lParam) { if (!strcmp(protoName,n->item.ProtocolName)) { - + if(n->item.enabled) { if(n->item.useIgnoreSettings && CallService(MS_IGNORE_ISIGNORED,wParam,IGNOREEVENT_USERONLINE)) @@ -177,10 +175,10 @@ int NudgeRecieved(WPARAM wParam,LPARAM lParam) if(n->item.showStatus) Nudge_ShowStatus(n->item, (HANDLE) wParam, nudgeSentTimestamp); } - + } break; - } + } } } else @@ -246,7 +244,7 @@ static INT_PTR CALLBACK DlgProcOptsTrigger(HWND hwnd, UINT msg, WPARAM wParam, L case WM_INITDIALOG: { // lParam = (LPARAM)(DWORD)actionID or 0 if this is a new trigger entry BOOL bshakeClist,bshakeChat; - + DWORD actionID = (DWORD)lParam; TranslateDialogDefault(hwnd); // Initialize the dialog according to the action ID @@ -291,7 +289,7 @@ int TriggerActionRecv( DWORD actionID, REPORTINFO *ri) /* // Actually show the message box DBVARIANT dbv; TCHAR *tszMsg; - + // Retrieve the correct settings for this action ID if (!DBGetActionSettingTString(actionID, NULL, MODULENAME, SETTING_TEXT, &dbv)) { // Parse by Variables, if available (notice extratext and subject are given). @@ -318,7 +316,7 @@ int TriggerActionSend( DWORD actionID, REPORTINFO *ri) if(hContact != NULL) NudgeSend((WPARAM)hContact,NULL); } - + return FALSE; } @@ -341,7 +339,7 @@ void LoadProtocols(void) { Nudge_AddAccount(ppProtocolDescriptors[i]); } - + } shake.Load(); @@ -367,7 +365,7 @@ void RegisterToTrigger(void) ar.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TRIGGER); ar.pszName = Translate("Nudge : Shake contact list/chat window"); - // register the action + // register the action CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar); ar.actionFunction = TriggerActionSend; @@ -420,7 +418,7 @@ static int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam) static int TabsrmmButtonInit(WPARAM wParam, LPARAM lParam) { BBButton bbd = {0}; - + bbd.cbSize = sizeof(BBButton); bbd.pszModuleName = "Nudge"; bbd.ptszTooltip = LPGENT("Send Nudge"); @@ -432,34 +430,34 @@ static int TabsrmmButtonInit(WPARAM wParam, LPARAM lParam) CallService (MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); return 0; -} +} -void HideNudgeButton(HANDLE hContact) -{ +void HideNudgeButton(HANDLE hContact) +{ char str[MAXMODULELABELLENGTH + 12] = {0}; char *szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); mir_snprintf(str,MAXMODULELABELLENGTH + 12,"%s/SendNudge", szProto); - if (!ServiceExists(str)) - { - BBButton bbd={0}; - bbd.cbSize=sizeof(BBButton); - bbd.bbbFlags=BBSF_HIDDEN|BBSF_DISABLED; + if (!ServiceExists(str)) + { + BBButton bbd={0}; + bbd.cbSize=sizeof(BBButton); + bbd.bbbFlags=BBSF_HIDDEN|BBSF_DISABLED; bbd.pszModuleName="Nudge"; bbd.dwButtonID = 6000; - CallService(MS_BB_SETBUTTONSTATE, (WPARAM)hContact, (LPARAM)&bbd); - } -} - -static int ContactWindowOpen(WPARAM wparam,LPARAM lParam) -{ - MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam; - - if(MWeventdata->uType == MSG_WINDOW_EVT_OPENING&&MWeventdata->hContact) - { - HideNudgeButton(MWeventdata->hContact); - } - return 0; + CallService(MS_BB_SETBUTTONSTATE, (WPARAM)hContact, (LPARAM)&bbd); + } +} + +static int ContactWindowOpen(WPARAM wparam,LPARAM lParam) +{ + MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam; + + if(MWeventdata->uType == MSG_WINDOW_EVT_OPENING&&MWeventdata->hContact) + { + HideNudgeButton(MWeventdata->hContact); + } + return 0; } int ModulesLoaded(WPARAM,LPARAM) @@ -496,20 +494,8 @@ int AccListChanged(WPARAM wParam,LPARAM lParam) HANDLE hShakeClist=NULL,hShakeChat=NULL,hNudgeSend=NULL,hNudgeShowMenu=NULL; extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) -{ +{ pluginLink = link; - if(mir_getMMI(&mmi)) - { - MessageBox(NULL,_T("Cannot retrieve Miranda Memory Manager Interface.\nYou need to update Miranda IM to the latest version."),_T("Nudge Plugin"),MB_OK); - return 1; - } - - if(mir_getUTFI(&utfi)) - { - MessageBox(NULL,_T("Cannot retrieve Miranda UTF8 Interface.\nYou need to update Miranda IM to the latest version."),_T("Nudge Plugin"),MB_OK); - return 1; - } - mir_getLP(&pluginInfo); g_hEventModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded); @@ -521,11 +507,11 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) hShakeChat=CreateServiceFunction(MS_SHAKE_CHAT,ShakeChat); hNudgeSend=CreateServiceFunction(MS_NUDGE_SEND,NudgeSend); hNudgeShowMenu=CreateServiceFunction(MS_NUDGE_SHOWMENU,NudgeShowMenu); - return 0; + return 0; } -extern "C" int __declspec(dllexport) Unload(void) -{ +extern "C" int __declspec(dllexport) Unload(void) +{ if(g_hEventToolbarLoaded) UnhookEvent(g_hEventToolbarLoaded); if(g_hEventDbWindowEvent) UnhookEvent(g_hEventButtonPressed); if(g_hEventDbWindowEvent) UnhookEvent(g_hEventDbWindowEvent); @@ -540,7 +526,7 @@ extern "C" int __declspec(dllexport) Unload(void) DestroyServiceFunction(hNudgeShowMenu); NudgeElementList* p = NudgeList; - while ( p != NULL ) + while ( p != NULL ) { if(p->item.hEvent) UnhookEvent(p->item.hEvent); NudgeElementList* p1 = p->next; @@ -548,10 +534,10 @@ extern "C" int __declspec(dllexport) Unload(void) delete p; p = p1; } - return 0; + return 0; } -LRESULT CALLBACK NudgePopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) +LRESULT CALLBACK NudgePopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { switch(msg) { @@ -565,7 +551,7 @@ LRESULT CALLBACK NudgePopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) case WM_CONTEXTMENU: PUDeletePopUp(hWnd); - break; + break; case UM_FREEPLUGINDATA: //Here we'd free our own data, if we had it. return FALSE; @@ -646,7 +632,7 @@ void Nudge_ShowPopup(CNudgeElement n, HANDLE hContact, TCHAR * Message) hContact = Nudge_GethContact(hContact); TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR); - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) + if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { POPUPDATACLASS NudgePopUp = {0}; NudgePopUp.cbSize = sizeof(NudgePopUp); @@ -655,7 +641,7 @@ void Nudge_ShowPopup(CNudgeElement n, HANDLE hContact, TCHAR * Message) NudgePopUp.ptszTitle = lpzContactName; NudgePopUp.pszClassName = "nudge"; CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&NudgePopUp); - } + } else if(ServiceExists(MS_POPUP_ADDPOPUPT)) { POPUPDATAT NudgePopUp = {0}; @@ -667,7 +653,7 @@ void Nudge_ShowPopup(CNudgeElement n, HANDLE hContact, TCHAR * Message) NudgePopUp.iSeconds = 0; NudgePopUp.PluginWindowProc = NudgePopUpProc; NudgePopUp.PluginData = (void *)1; - + //lstrcpy(NudgePopUp.lpzText, Translate(Message)); lstrcpy(NudgePopUp.lptzText, Message); @@ -703,8 +689,8 @@ void Nudge_SentStatus(CNudgeElement n, HANDLE hContact) if(hMetaContact != NULL) //metacontact CallService(MS_DB_EVENT_ADD,(WPARAM)hMetaContact,(LPARAM)&NudgeEvent); } - - + + CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&NudgeEvent); } @@ -722,7 +708,7 @@ void Nudge_ShowStatus(CNudgeElement n, HANDLE hContact, DWORD timestamp) NudgeEvent.eventType = EVENTTYPE_STATUSCHANGE; NudgeEvent.cbBlob = (DWORD)strlen(buff) + 1; NudgeEvent.pBlob = ( PBYTE ) buff; - + INT_PTR res = CallService( MS_MC_GETMETACONTACT, (WPARAM)hContact, 0 ); //try to retrieve the metacontact if some if(res != CALLSERVICE_NOTFOUND) @@ -734,7 +720,7 @@ void Nudge_ShowStatus(CNudgeElement n, HANDLE hContact, DWORD timestamp) NudgeEvent.flags |= DBEF_READ; } } - + CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&NudgeEvent); } @@ -747,7 +733,7 @@ HANDLE Nudge_GethContact(HANDLE hContact) if(hMetaContact!=NULL) return hMetaContact; } - + return hContact; } @@ -758,7 +744,7 @@ void Nudge_AddAccount(PROTOACCOUNT *proto) HANDLE hevent = HookEvent(str, NudgeRecieved); if(hevent == NULL) return; - + nProtocol ++; //Add a specific sound per protocol @@ -774,12 +760,12 @@ void Nudge_AddAccount(PROTOACCOUNT *proto) newNudge->item.hEvent = hevent; TCHAR soundDesc[MAXMODULELABELLENGTH + 10]; - mir_sntprintf(soundDesc,sizeof(soundDesc),_T("Nudge for %s"),proto->tszAccountName); + mir_sntprintf(soundDesc,sizeof(soundDesc),_T("Nudge for %s"),proto->tszAccountName); SkinAddNewSoundExT(newNudge->item.NudgeSoundname, LPGENT("Nudge"), soundDesc); - + newNudge->next = NudgeList; NudgeList = newNudge; - + char iconName[MAXMODULELABELLENGTH + 10]; mir_snprintf(iconName,sizeof(iconName),"Nudge_%s",proto->szModuleName); @@ -797,7 +783,7 @@ void Nudge_AddAccount(PROTOACCOUNT *proto) sid.iDefaultIndex = -IDI_NUDGE; sid.hDefaultIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NUDGE)); newNudge->item.hIcoLibItem = Skin_AddIcon(&sid); - + //Add contact menu entry CLISTMENUITEM mi = {0}; mi.cbSize = sizeof(mi); @@ -812,7 +798,7 @@ void Nudge_AddAccount(PROTOACCOUNT *proto) newNudge->item.hContactMenu = Menu_AddContactMenuItem(&mi); } -void AutoResendNudge(void *wParam) +void AutoResendNudge(void *wParam) { Sleep(GlobalNudge.resendDelaySec * 1000); diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index 308a3d04d4..611ac05881 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -24,7 +24,6 @@ PLUGINLINK *pluginLink; HANDLE hOptHook = NULL, hLoadHook = NULL, hPackUpdaterFolder = NULL, hCheckUpdates = NULL, hEmptyFolder = NULL, hOnPreShutdown = NULL; TCHAR tszRoot[MAX_PATH] = {0}; int hLangpack; -struct MM_INTERFACE mmi; PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), @@ -57,7 +56,6 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) CLISTMENUITEM mi; pluginLink = link; mir_getLP(&pluginInfoEx); - mir_getMMI(&mmi); TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\"DEFAULT_UPDATES_FOLDER)); lstrcpyn(tszRoot, tszFolder, SIZEOF(tszRoot)); if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index b013ecb3dc..7fecae0141 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -39,9 +39,6 @@ HANDLE hMainThread; PLUGINLINK *pluginLink; HANDLE hSemaphore; BOOL closing = FALSE; -MM_INTERFACE mmi; -LIST_INTERFACE li; -UTF8_INTERFACE utfi; MTEXT_INTERFACE MText = {0}; HANDLE folderId; BOOL gbPopupLoaded = FALSE; diff --git a/plugins/Popup/src/config.h b/plugins/Popup/src/config.h index 3fe8e7facc..2f6a25d33e 100644 --- a/plugins/Popup/src/config.h +++ b/plugins/Popup/src/config.h @@ -144,12 +144,10 @@ void LoadOptions(); //===== General Plugin ===== extern HINSTANCE hInst; extern HANDLE hMainThread; -//extern MNOTIFYLINK *notifyLink; //deprecatet extern PLUGINLINK *pluginLink; extern HANDLE hSemaphore; extern BOOL closing; extern HANDLE folderId; -extern UTF8_INTERFACE utfi; extern MTEXT_INTERFACE MText; extern HANDLE htuText; diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 06779ef5d5..acd94f3cdc 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -112,7 +112,7 @@ static struct { {MS_POPUP_GETCONTACT, PopUp_GetContact, 0}, {MS_POPUP_GETPLUGINDATA, PopUp_GetPluginData, 0}, {MS_POPUP_ISSECONDLINESHOWN, PopUp_IsSecondLineShown, 0}, - + {MS_POPUP_SHOWMESSAGE, PopUp_ShowMessage, 0}, {MS_POPUP_SHOWMESSAGEW, PopUp_ShowMessageW, 0}, {MS_POPUP_QUERY, PopUp_Query, 0}, @@ -266,7 +266,7 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM wp, LPARAM lp) DBWriteContactSettingByte(NULL, MODULNAME, "ModuleIsEnabled", FALSE); mi.ptszName = LPGENT("Enable &popup module"); mi.hIcon = IcoLib_GetIcon(ICO_POPUP_OFF,0); - } + } else { //The module is disabled. //The action to do is enable popups (show enabled), then write "disable popup" in the new item. @@ -334,7 +334,7 @@ INT_PTR GetStatus(WPARAM wp, LPARAM lp) } //register Updatersupport -void registerUpdate() { +void registerUpdate() { Update update = {0}; char szVersion[16]; update.cbSize = sizeof(Update); @@ -359,7 +359,7 @@ void registerUpdate() { } //register Hotkey -void LoadHotkey() { +void LoadHotkey() { HOTKEYDESC hk = {0}; hk.cbSize = sizeof(hk); hk.dwFlags = HKD_TCHAR; @@ -503,9 +503,7 @@ MIRAPI int Load(PLUGINLINK *link) DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0); - mir_getLI (&li); - mir_getUTFI (&utfi); - mir_getMTI (&MText); + mir_getMTI(&MText); mir_getLP(&pluginInfoEx); #if defined(_DEBUG) @@ -547,7 +545,7 @@ MIRAPI int Load(PLUGINLINK *link) if (DBGetContactSetting(NULL, "KnownModules", MODULNAME, &dbv)) DBWriteContactSettingString(NULL, "KnownModules", pluginInfoEx.shortName, MODULNAME); DBFreeVariant(&dbv); - + hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OptionsInitialize); hOkToExit = HookEvent(ME_SYSTEM_OKTOEXIT, OkToExit); diff --git a/plugins/QuickMessages/Utils.cpp b/plugins/QuickMessages/Utils.cpp index 01b020228c..9531268524 100644 --- a/plugins/QuickMessages/Utils.cpp +++ b/plugins/QuickMessages/Utils.cpp @@ -58,7 +58,7 @@ void li_ListDestruct(SortedList *pList, ItemDestuctor pItemDestructor) int i=0; if (!pList) return; for (i=0; irealCount; i++) pItemDestructor(pList->items[i]); - li.List_Destroy(pList); + List_Destroy(pList); mir_free(pList); } @@ -67,13 +67,13 @@ void li_RemoveDestruct(SortedList *pList, int index, ItemDestuctor pItemDestruct if (index>=0 && indexrealCount) { pItemDestructor(pList->items[index]); - li.List_Remove(pList, index); + List_Remove(pList, index); } } void li_RemovePtrDestruct(SortedList *pList, void * ptr, ItemDestuctor pItemDestructor) { - if (li.List_RemovePtr(pList, ptr)) + if (List_RemovePtr(pList, ptr)) pItemDestructor(ptr); } @@ -105,7 +105,7 @@ void li_ZeroQuickList(SortedList *pList) qd->bIsService=0; qd->ptszValue=NULL; qd->ptszValueName=NULL; - li.List_Remove(pList, i); + List_Remove(pList, i); i--; } } @@ -269,7 +269,7 @@ DWORD BalanceButtons(int buttonsWas,int buttonsNow) void InitButtonsList() { int i,j,k=0; - QuickList=li.List_Create(0,1); + QuickList=List_Create(0,1); for(i=0;isl=li.List_Create(0,1); + ld->sl=List_Create(0,1); ld->ptszQValue=ld->ptszOPQValue=getMenuEntry(i,0,2); ld->ptszButtonName=pszBName; ld->dwPos=ld->dwOPPos=i; @@ -309,9 +309,9 @@ void InitButtonsList() qd->dwPos=k++; qd->ptszValue=bd->pszValue; qd->ptszValueName=bd->pszName; - li.List_InsertPtr(QuickList,qd); + List_InsertPtr(QuickList,qd); } - li.List_InsertPtr((SortedList*)ld->sl,bd); + List_InsertPtr((SortedList*)ld->sl,bd); } } @@ -333,7 +333,7 @@ while(ButtonsList[i]) if(QuickList) { li_ZeroQuickList(QuickList); - li.List_Destroy(QuickList); + List_Destroy(QuickList); } } diff --git a/plugins/QuickMessages/main.cpp b/plugins/QuickMessages/main.cpp index a4c6684b10..da0171a8f2 100644 --- a/plugins/QuickMessages/main.cpp +++ b/plugins/QuickMessages/main.cpp @@ -28,15 +28,12 @@ hEventDbPreShutdown; HICON hIcon; int g_iButtonsCount=0; -int g_bShutDown=0; +int g_bShutDown=0; int g_bStartup=0; BOOL g_bRClickAuto=0; BOOL g_bLClickAuto=0; BOOL g_bQuickMenu=0; -struct MM_INTERFACE mmi; -struct LIST_INTERFACE li; - PLUGINLINK *pluginLink; int hLangpack; @@ -50,13 +47,13 @@ PLUGININFOEX pluginInfo = { "© 2008 Danil Mozhar", "http://miranda.radicaled.ru/index.php?plugin=3", UNICODE_AWARE, - 0, + 0, // {37ED754B-6CF9-40ed-9EB6-0FEF8E822475} { 0x37ed754b, 0x6cf9, 0x40ed, { 0x9e, 0xb6, 0xf, 0xef, 0x8e, 0x82, 0x24, 0x75 } } }; int PreShutdown(WPARAM wparam,LPARAM lparam) -{ +{ g_bShutDown=1; DestructButtonsList(); @@ -83,7 +80,7 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam) InsertMenu((HMENU)mwpd->hMenu,6,MF_STRING|MF_POPUP|MF_BYPOSITION,(UINT_PTR)hSubMenu,TranslateT("Quick Messages")); InsertMenu((HMENU)mwpd->hMenu,7,MF_SEPARATOR|MF_BYPOSITION,0,0); - qsort(QuickList->items,QuickList->realCount,sizeof(QuickData *),sstQuickSortButtons); + qsort(QuickList->items,QuickList->realCount,sizeof(QuickData *),sstQuickSortButtons); for(i=0;irealCount;i++) { QuickData* qd= (QuickData *)QuickList->items[i]; @@ -110,7 +107,7 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam) if(IsClipboardFormatAvailable(CF_TEXT)) { if (OpenClipboard(mwpd->hwnd)) { HANDLE hData=NULL; - TCHAR* chBuffer=NULL; + TCHAR* chBuffer=NULL; int textLength=0; hData= GetClipboardData(CF_UNICODETEXT); @@ -122,10 +119,10 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam) CloseClipboard(); } } - - SendMessage(mwpd->hwnd, EM_EXGETSEL, 0, (LPARAM)&cr); + + SendMessage(mwpd->hwnd, EM_EXGETSEL, 0, (LPARAM)&cr); textlenght=cr.cpMax-cr.cpMin; - + if(textlenght) { pszText = (TCHAR *)mir_alloc((textlenght+10)*sizeof(TCHAR)); @@ -177,7 +174,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) if(strcmp(cbcd->pszModule,PLGNAME)) return 0; if (!ButtonsList[cbcd->dwButtonId]) return 1; - + sl=ButtonsList[cbcd->dwButtonId]->sl; if (!sl) return 1; @@ -185,7 +182,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) if(IsClipboardFormatAvailable(CF_TEXT)) { if (OpenClipboard(cbcd->hwndFrom)) { HANDLE hData=NULL; - TCHAR* chBuffer=NULL; + TCHAR* chBuffer=NULL; int textLength=0; hData= GetClipboardData(CF_UNICODETEXT); @@ -201,13 +198,13 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) - qsort(sl->items,sl->realCount,sizeof(ButtonData *),sstSortButtons); + qsort(sl->items,sl->realCount,sizeof(ButtonData *),sstSortButtons); hEdit=GetDlgItem(cbcd->hwndFrom,IDC_MESSAGE); if (!hEdit) hEdit=GetDlgItem(cbcd->hwndFrom,IDC_CHATMESSAGE); cr.cpMin = cr.cpMax = 0; - SendMessage(hEdit, EM_EXGETSEL, 0, (LPARAM)&cr); + SendMessage(hEdit, EM_EXGETSEL, 0, (LPARAM)&cr); textlenght=cr.cpMax-cr.cpMin; if(textlenght) @@ -221,7 +218,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) state=1; else if(sl->realCount==1) state=2; - else + else state=3; @@ -244,7 +241,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) if ((bIsService=bd->bIsServName)&&ptszQValue) CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0); - + } } break; @@ -308,7 +305,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) } free(ptszQValue); } - + if(pszText) mir_free(pszText); if(pszCBText) mir_free(pszCBText); @@ -320,7 +317,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) { g_bStartup=1; hEventDbOptionsInit=HookEvent(ME_OPT_INITIALISE,OptionsInit); - hEventCBButtonPressed=HookEvent(ME_MSG_BUTTONPRESSED,CustomButtonPressed); + hEventCBButtonPressed=HookEvent(ME_MSG_BUTTONPRESSED,CustomButtonPressed); hEventCBInit=HookEvent(ME_MSG_TOOLBARLOADED,RegisterCustomButton); hEventInputMenu=HookEvent(ME_MSG_WINDOWPOPUP,InputMenuPopup); @@ -375,8 +372,6 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink=link; - mir_getMMI(&mmi); - mir_getLI(&li); mir_getLP(&pluginInfo); hEventDbPluginsLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit); diff --git a/plugins/QuickMessages/options.cpp b/plugins/QuickMessages/options.cpp index ab369abfd0..4527e1c858 100644 --- a/plugins/QuickMessages/options.cpp +++ b/plugins/QuickMessages/options.cpp @@ -321,7 +321,7 @@ void SaveMenuTree(HWND hdlg) qd->bIsService=bd->bIsServName; qd->ptszValue=bd->pszValue; qd->ptszValueName=bd->pszName; - li.List_InsertPtr(QuickList,qd); + List_InsertPtr(QuickList,qd); } SaveModuleSettings(iBl,bd); @@ -1003,7 +1003,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) ld = (ListData *)mir_alloc(sizeof(ListData)); ButtonsList[g_iOPButtonsCount++]=ld; - ld->sl=li.List_Create(0,1); + ld->sl=List_Create(0,1); ld->dwOPFlags=QMF_NEW; ld->bIsOpServName=0; ld->ptszButtonName=NULL; @@ -1079,7 +1079,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) sl=((ListData*)tvi.lParam)->sl; - li.List_InsertPtr(sl,bd); + List_InsertPtr(sl,bd); tvis.hParent = NULL; tvis.hInsertAfter = TVI_LAST; diff --git a/plugins/QuickMessages/quickmessages.h b/plugins/QuickMessages/quickmessages.h index 51f5f247d5..5de5f0eb52 100644 --- a/plugins/QuickMessages/quickmessages.h +++ b/plugins/QuickMessages/quickmessages.h @@ -49,7 +49,6 @@ along with this program. If not, see . #define MODULENAME "Quick Messages" #define PLGNAME "QuickMessages" -extern struct LIST_INTERFACE li; extern HINSTANCE hinstance; extern HICON hIcon; extern ListData* ButtonsList[100]; @@ -85,7 +84,3 @@ int OptionsInit(WPARAM,LPARAM); #define QMESSAGES_UPDATE_URL "http://miranda.radicaled.ru/public/quickmessages/"QMESSAGES_NAME".zip" #define QMESSAGES_VERSION_PREFIX "QuickMessages " - - - - diff --git a/plugins/QuickReplies/quickreplies.cpp b/plugins/QuickReplies/quickreplies.cpp index 7f50f9be38..82d2ee38ac 100644 --- a/plugins/QuickReplies/quickreplies.cpp +++ b/plugins/QuickReplies/quickreplies.cpp @@ -21,7 +21,6 @@ Boston, MA 02111-1307, USA. HINSTANCE hInstance = NULL; PLUGINLINK *pluginLink; -struct MM_INTERFACE mmi; int hLangpack; HANDLE hOnModulesLoaded; @@ -57,9 +56,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(PLUGINLINK* link) { pluginLink = link; - mir_getLP(&pluginInfoEx); - mir_getMMI(&mmi); - + mir_getLP(&pluginInfoEx); hOnModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); hOnPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); diff --git a/plugins/Rate/main.cpp b/plugins/Rate/main.cpp index d1f1b0f71f..be4aae14ed 100644 --- a/plugins/Rate/main.cpp +++ b/plugins/Rate/main.cpp @@ -55,7 +55,6 @@ IconExtraColumn g_IECClear = {0}; int clistIcon = 0; //Icon slot to use byte bRate = 0; int hLangpack; -struct MM_INTERFACE mmi; extern int onOptInitialise(WPARAM wParam, LPARAM lParam); @@ -265,9 +264,7 @@ int onContactSettingChanged(WPARAM wParam,LPARAM lParam) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink=link; - mir_getLP(&pluginInfo); - mir_getMMI(&mmi); - + mir_getLP(&pluginInfo); hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded); hSystemOKToExit = HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit); hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged); diff --git a/plugins/RecentContacts/RecentContacts.cpp b/plugins/RecentContacts/RecentContacts.cpp index 2fbc861b98..08bd2d5566 100644 --- a/plugins/RecentContacts/RecentContacts.cpp +++ b/plugins/RecentContacts/RecentContacts.cpp @@ -11,8 +11,6 @@ HINSTANCE hInst = NULL; PLUGINLINK *pluginLink = NULL; int hLangpack = 0; -MM_INTERFACE mmi; -LIST_INTERFACE li; HANDLE hTopToolbarButtonShowList; HANDLE hMsgWndEvent; @@ -639,10 +637,7 @@ INT_PTR ToggleIgnore (WPARAM wParam, LPARAM lParam) extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; - mir_getLP( &pluginInfo ); - mir_getMMI( &mmi ); - mir_getLI( &li ); - + mir_getLP( &pluginInfo ); CoInitialize(NULL); hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); diff --git a/plugins/SRMM/commonheaders.h b/plugins/SRMM/commonheaders.h index 89911bcab1..d9372700cb 100644 --- a/plugins/SRMM/commonheaders.h +++ b/plugins/SRMM/commonheaders.h @@ -1,6 +1,6 @@ /* -Copyright 2000-2012 Miranda IM project, -all portions of this codebase are copyrighted to the people +Copyright 2000-2012 Miranda IM project, +all portions of this codebase are copyrighted to the people listed in contributors.txt. This program is free software; you can redistribute it and/or @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define _WIN32_WINNT 0x0501 #define _WIN32_IE 0x0501 -#define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #include @@ -70,7 +70,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "richutil.h" #include "version.h" -extern struct LIST_INTERFACE li; extern HINSTANCE g_hInst; - - diff --git a/plugins/SRMM/srmm.cpp b/plugins/SRMM/srmm.cpp index 20ef673b8e..fc89f36dd9 100644 --- a/plugins/SRMM/srmm.cpp +++ b/plugins/SRMM/srmm.cpp @@ -27,9 +27,6 @@ PLUGINLINK* pluginLink; HINSTANCE g_hInst; int hLangpack; -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; -struct LIST_INTERFACE li; TIME_API tmi; PLUGININFOEX pluginInfo = { @@ -66,9 +63,6 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) extern "C" int __declspec(dllexport) Load(PLUGINLINK * link) { pluginLink = link; - mir_getMMI(&mmi); - mir_getUTFI(&utfi); - mir_getLI(&li); mir_getTMI(&tmi); mir_getLP(&pluginInfo); diff --git a/plugins/Scriver/richutil.cpp b/plugins/Scriver/richutil.cpp index 069d0cfaac..8c562b060c 100644 --- a/plugins/Scriver/richutil.cpp +++ b/plugins/Scriver/richutil.cpp @@ -1,6 +1,6 @@ /* -Copyright 2000-2010 Miranda IM project, -all portions of this codebase are copyrighted to the people +Copyright 2000-2010 Miranda IM project, +all portions of this codebase are copyrighted to the people listed in contributors.txt. This program is free software; you can redistribute it and/or @@ -25,21 +25,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. RichUtil_Load(); Before the application exits, call: RichUtil_Unload(); - + Then to use the library (it draws the xp border around it), you need - to make sure you control has the WS_EX_STATICEDGE flag. Then you just + to make sure you control has the WS_EX_STATICEDGE flag. Then you just subclass it with: RichUtil_SubClass(hwndEdit); - + If no xptheme is present, the window isn't subclassed the SubClass function just returns. And if WS_EX_STATICEDGE isn't present, the subclass does nothing. Otherwise it removes the border and draws it by itself. */ -extern struct LIST_INTERFACE li; static SortedList sListInt; -static int RichUtil_CmpVal(void *p1, void *p2) +static int RichUtil_CmpVal(void *p1, void *p2) { TRichUtil *tp1 = (TRichUtil*)p1; TRichUtil *tp2 = (TRichUtil*)p2; @@ -65,7 +64,7 @@ static CRITICAL_SECTION csRich; static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); static void RichUtil_ClearUglyBorder(TRichUtil *ru); -void RichUtil_Load(void) +void RichUtil_Load(void) { sListInt.increment = 10; sListInt.sortFunc = RichUtil_CmpVal; @@ -91,14 +90,14 @@ void RichUtil_Load(void) !MyDrawThemeBackground || !MyGetThemeBackgroundContentRect || !MyDrawThemeParentBackground || - !MyIsThemeBackgroundPartiallyTransparent) + !MyIsThemeBackgroundPartiallyTransparent) { FreeLibrary(mTheme); mTheme = NULL; } } -void RichUtil_Unload(void) +void RichUtil_Unload(void) { List_Destroy(&sListInt); DeleteCriticalSection(&csRich); @@ -106,14 +105,14 @@ void RichUtil_Unload(void) FreeLibrary(mTheme); } -int RichUtil_SubClass(HWND hwndEdit) +int RichUtil_SubClass(HWND hwndEdit) { - if (IsWindow(hwndEdit)) + if (IsWindow(hwndEdit)) { int idx; TRichUtil *ru = (TRichUtil*)mir_calloc(sizeof(TRichUtil)); - + ru->hwnd = hwndEdit; ru->hasUglyBorder = 0; @@ -133,7 +132,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { TRichUtil *ru = NULL, tru; int idx; - + tru.hwnd = hwnd; EnterCriticalSection(&csRich); @@ -141,7 +140,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ru = (TRichUtil*)sListInt.items[idx]; LeaveCriticalSection(&csRich); - switch(msg) + switch(msg) { case WM_THEMECHANGED: case WM_STYLECHANGED: @@ -153,11 +152,11 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_NCPAINT: { LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam); - if (ru->hasUglyBorder && MyIsThemeActive()) + if (ru->hasUglyBorder && MyIsThemeActive()) { HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT"); - if (hTheme) + if (hTheme) { RECT rcBorder; RECT rcClient; @@ -195,17 +194,17 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam); NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS*)lParam; - - if (ru->hasUglyBorder && MyIsThemeActive()) + + if (ru->hasUglyBorder && MyIsThemeActive()) { HANDLE hTheme = MyOpenThemeData(hwnd, L"EDIT"); - if (hTheme) + if (hTheme) { - RECT rcClient ={0}; + RECT rcClient ={0}; HDC hdc = GetDC(GetParent(hwnd)); - if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) + if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) { ru->rect.left = rcClient.left-ncsParam->rgrc[0].left; ru->rect.top = rcClient.top-ncsParam->rgrc[0].top; @@ -235,7 +234,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam); - if (IsWindow(hwnd)) + if (IsWindow(hwnd)) { if ((WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC) == &RichUtil_Proc) SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)ru->origProc); diff --git a/plugins/Scriver/srmm.cpp b/plugins/Scriver/srmm.cpp index 41f4ceb009..d0547d1ad6 100644 --- a/plugins/Scriver/srmm.cpp +++ b/plugins/Scriver/srmm.cpp @@ -25,9 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int OnLoadModule(void); int OnUnloadModule(void); -struct MM_INTERFACE mmi; -struct LIST_INTERFACE li; -struct UTF8_INTERFACE utfi; TIME_API tmi; PLUGINLINK *pluginLink; @@ -72,9 +69,6 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK * link) pluginLink = link; // set the memory manager - mir_getMMI( &mmi ); - mir_getLI( &li ); - mir_getUTFI( &utfi ); mir_getTMI(&tmi); mir_getLP( &pluginInfo ); diff --git a/plugins/SecureIM/main.cpp b/plugins/SecureIM/main.cpp index de80e12cf0..461d903bd0 100644 --- a/plugins/SecureIM/main.cpp +++ b/plugins/SecureIM/main.cpp @@ -1,7 +1,6 @@ #include "commonheaders.h" PLUGINLINK *pluginLink; -MM_INTERFACE mmi = {0}; int hLangpack = 0; extern "C" BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID) { @@ -27,7 +26,7 @@ MUUID* MirandaPluginInterfaces(void) { void AddServiceFunction(LPCSTR serviceName, MIRANDASERVICE serviceFunction) { - + g_hService = (HANDLE*) mir_realloc(g_hService,sizeof(HANDLE)*(iService+1)); g_hService[iService] = CreateServiceFunction(serviceName, serviceFunction); iService++; @@ -35,7 +34,7 @@ void AddServiceFunction(LPCSTR serviceName, MIRANDASERVICE serviceFunction) { void AddProtoServiceFunction(LPCSTR serviceName, MIRANDASERVICE serviceFunction) { - + g_hService = (HANDLE*) mir_realloc(g_hService,sizeof(HANDLE)*(iService+1)); g_hService[iService] = CreateProtoServiceFunction(szModuleName, serviceName, serviceFunction); iService++; @@ -43,7 +42,7 @@ void AddProtoServiceFunction(LPCSTR serviceName, MIRANDASERVICE serviceFunction) void AddHookFunction(LPCSTR eventName, MIRANDAHOOK hookFunction) { - + g_hHook = (HANDLE*) mir_realloc(g_hHook,sizeof(HANDLE)*(iHook+1)); g_hHook[iHook] = HookEvent(eventName, hookFunction); iHook++; @@ -98,7 +97,6 @@ int __cdecl Load(PLUGINLINK *link) { } // get memoryManagerInterface address - mir_getMMI( &mmi ); //get per-plugin langpack interface mir_getLP(&pluginInfoEx); @@ -147,7 +145,7 @@ int __cdecl Load(PLUGINLINK *link) { // hook events AddHookFunction(ME_SYSTEM_MODULESLOADED, onModulesLoaded); - AddHookFunction(ME_SYSTEM_OKTOEXIT, onSystemOKToExit); + AddHookFunction(ME_SYSTEM_OKTOEXIT, onSystemOKToExit); g_hEvent[0] = CreateHookableEvent(MODULENAME"/Disabled"); g_hEvent[1] = CreateHookableEvent(MODULENAME"/Established"); @@ -238,7 +236,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { // DBDeleteContactSetting(0, szModuleName, "rsa_pub_4096"); rsa_4096=1; - } + } if ( !rsa_4096 ) { unsigned int tID; @@ -463,7 +461,7 @@ int __cdecl onModulesLoaded(WPARAM wParam,LPARAM lParam) { g_hMenu[13] = AddMenuItem(sim231[2],110013,NULL,MODULENAME"/MODE_GPG"); g_hMenu[14] = AddMenuItem(sim231[3],110014,NULL,MODULENAME"/MODE_RSA"); } - + // updater plugin support if(ServiceExists(MS_UPDATE_REGISTERFL)) { CallService(MS_UPDATE_REGISTERFL, (WPARAM)2445, (LPARAM)&pluginInfoEx); diff --git a/plugins/SeenPlugin/main.cpp b/plugins/SeenPlugin/main.cpp index 949a898cd6..16001e19ac 100644 --- a/plugins/SeenPlugin/main.cpp +++ b/plugins/SeenPlugin/main.cpp @@ -27,7 +27,6 @@ Last change by : $Author: y_b $ HINSTANCE hInstance; HANDLE ehdb = NULL, ehproto = NULL, ehmissed = NULL, ehuserinfo = NULL, ehmissed_proto = NULL, hOptInit = NULL, hMainInit = NULL; PLUGINLINK *pluginLink; -struct MM_INTERFACE mmi; int hLangpack; PLUGININFOEX pluginInfo={ @@ -127,7 +126,6 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved) extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink=link; - mir_getMMI(&mmi); mir_getLP(&pluginInfo); // this isn't required for most events // but the ME_USERINFO_INITIALISE diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 2e418dbb88..fc11631847 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -39,13 +39,12 @@ HWND hClistControl; unsigned int ses_limit; unsigned int g_ses_count; -BOOL g_bExclHidden; +BOOL g_bExclHidden; BOOL g_bWarnOnHidden; BOOL g_bOtherWarnings; BOOL g_bCrashRecovery; BOOL g_bIncompletedSave; -struct MM_INTERFACE mmi; HWND g_hDlg; HWND g_hSDlg; BOOL DONT = FALSE; @@ -73,14 +72,14 @@ PLUGININFOEX pluginInfo = { __COPYRIGHT, __AUTHORWEB, UNICODE_AWARE, - 0, + 0, // {60558872-2AAB-45aa-888D-097691C9B683} { 0x60558872, 0x2aab, 0x45aa, { 0x88, 0x8d, 0x9, 0x76, 0x91, 0xc9, 0xb6, 0x83 } } }; INT_PTR CALLBACK ExitDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) -{ +{ switch(msg) { case WM_INITDIALOG: @@ -101,7 +100,7 @@ INT_PTR CALLBACK ExitDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) DBWriteContactSettingByte(NULL, __INTERNAL_NAME, "lastempty", 0); DestroyWindow(hdlg); }break; - + case IDCANCEL: { SavePosition(hdlg, "ExitDlg"); @@ -125,7 +124,7 @@ INT_PTR CALLBACK ExitDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) } INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) -{ +{ g_hSDlg = hdlg; switch(msg) { @@ -180,8 +179,8 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar dy=20; dx=150; dd=5; - hClistControl = CreateWindowEx(WS_EX_CLIENTEDGE,CLISTCONTROL_CLASS, _T(""), - WS_TABSTOP |WS_VISIBLE | WS_CHILD , + hClistControl = CreateWindowEx(WS_EX_CLIENTEDGE,CLISTCONTROL_CLASS, _T(""), + WS_TABSTOP |WS_VISIBLE | WS_CHILD , x, y, dx, dy, hdlg, (HMENU)IDC_CLIST, hinstance, 0); SetWindowLongPtr(hClistControl, GWL_STYLE, @@ -248,7 +247,7 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar g_hSDlg=0; } else if (!SaveUserSessionName(szUserSessionName)) - { + { SaveSessionHandles(0,1); if(IsDlgButtonChecked(hdlg,IDC_SANDCCHECK)) @@ -260,9 +259,9 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar MessageBox(NULL,TranslateT("Current session is empty!"),TranslateT("Sessions Manager"),MB_OK|MB_ICONWARNING); } else - MessageBox(NULL,TranslateT("Session name is empty, enter the name and try again"),TranslateT("Sessions Manager"),MB_OK|MB_ICONWARNING); + MessageBox(NULL,TranslateT("Session name is empty, enter the name and try again"),TranslateT("Sessions Manager"),MB_OK|MB_ICONWARNING); }break; - + case IDCANCEL: { SavePosition(hdlg, "SaveDlg"); @@ -279,12 +278,12 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar } INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) -{ +{ g_hDlg=hdlg; switch(msg) { case WM_INITDIALOG: - { + { int iDelay=DBGetContactSettingWord(NULL, __INTERNAL_NAME, "StartupModeDelay", 1500); if(g_hghostw==TRUE) SetTimer(hdlg, TIMERID_LOAD, iDelay, NULL); @@ -292,11 +291,11 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar { ses_count=0; TranslateDialogDefault(hdlg); - if ((ses_count=LoadSessionToCombobox(hdlg,0,ses_limit,"SessionDate",0))==ses_limit) + if ((ses_count=LoadSessionToCombobox(hdlg,0,ses_limit,"SessionDate",0))==ses_limit) EnableWindow(GetDlgItem(hdlg,IDC_SESSDEL),TRUE); - if(LoadSessionToCombobox(hdlg,0,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0) - ses_count=0; + if(LoadSessionToCombobox(hdlg,0,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0) + ses_count=0; if(session_list_recovered[0]) ses_count=256; @@ -366,10 +365,10 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar EnableWindow(GetDlgItem(hdlg,IDC_SESSDEL),FALSE); SendDlgItemMessage(hdlg, IDC_LIST, CB_RESETCONTENT, 0, 0); - if ((ses_count=LoadSessionToCombobox(hdlg,1,ses_limit,"SessionDate",0))==ses_limit) + if ((ses_count=LoadSessionToCombobox(hdlg,1,ses_limit,"SessionDate",0))==ses_limit) EnableWindow(GetDlgItem(hdlg,IDC_SESSDEL),TRUE); - if(LoadSessionToCombobox(hdlg,1,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0) + if(LoadSessionToCombobox(hdlg,1,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0) ses_count=0; SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, (WPARAM)0, 0); @@ -392,12 +391,12 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar SendDlgItemMessage(hdlg, IDC_LIST, CB_SETCURSEL, (WPARAM)0, 0); } - else + else { DeleteAutoSession(ses_count); EnableWindow(GetDlgItem(hdlg,IDC_SESSDEL),FALSE); SendDlgItemMessage(hdlg, IDC_LIST, CB_RESETCONTENT, 0, 0); - if ((ses_count=LoadSessionToCombobox(hdlg,0,ses_limit,"SessionDate",0))==ses_limit) + if ((ses_count=LoadSessionToCombobox(hdlg,0,ses_limit,"SessionDate",0))==ses_limit) EnableWindow(GetDlgItem(hdlg,IDC_SESSDEL),TRUE); if(LoadSessionToCombobox(hdlg,0,255,"UserSessionDsc",ses_limit)==0 && ses_count!=0) @@ -414,7 +413,7 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar }break; case IDOK: - { + { if (!LoadSession(0,ses_count)) { SavePosition(hdlg, "LoadDlg"); @@ -439,14 +438,14 @@ INT_PTR CALLBACK LoadSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar } INT_PTR CloseCurrentSession(WPARAM wparam,LPARAM lparam) -{ +{ HWND hWnd; int i=0; MessageWindowInputData mwid; MessageWindowData mwd; while(session_list[0]!=0) - { + { mwid.cbSize = sizeof(MessageWindowInputData); mwid.hContact=(HANDLE)session_list[i]; mwid.uFlags=MSG_WINDOW_UFLAG_MSG_BOTH; @@ -476,9 +475,9 @@ int SaveSessionHandles(WPARAM wparam,LPARAM lparam) { for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) - { + { if ((k=CheckForDuplicate(session_list,(DWORD)hContact))!=-1 - &&!(g_bExclHidden&&!CheckContactVisibility(hContact))) + &&!(g_bExclHidden&&!CheckContactVisibility(hContact))) { AddSessionMark((HANDLE)hContact,lparam,'1'); AddInSessionOrder((HANDLE)hContact,lparam,k,1); @@ -486,7 +485,7 @@ int SaveSessionHandles(WPARAM wparam,LPARAM lparam) else { AddSessionMark((HANDLE)hContact,lparam,'0'); - AddInSessionOrder((HANDLE)hContact,lparam,0,0); + AddInSessionOrder((HANDLE)hContact,lparam,0,0); } } if(lparam==1) @@ -502,11 +501,11 @@ int SaveSessionHandles(WPARAM wparam,LPARAM lparam) INT_PTR SaveUserSessionHandles(WPARAM wparam,LPARAM lparam) { - if (g_hSDlg) + if (g_hSDlg) { ShowWindow(g_hSDlg,SW_SHOW); return 1; - } + } else g_hSDlg=CreateDialog(hinstance,MAKEINTRESOURCE(IDD_SAVEDIALOG), 0, SaveSessionDlgProc); @@ -514,14 +513,14 @@ INT_PTR SaveUserSessionHandles(WPARAM wparam,LPARAM lparam) } INT_PTR OpenSessionsManagerWindow(WPARAM wparam,LPARAM lparam) -{ +{ if (g_hDlg) { ShowWindow(g_hDlg,SW_SHOW); return 0; } - if(g_bIncompletedSave||DBGetStringT(NULL, __INTERNAL_NAME, "SessionDate_0")||DBGetStringT(NULL, __INTERNAL_NAME, "UserSessionDsc_0")) - { + if(g_bIncompletedSave||DBGetStringT(NULL, __INTERNAL_NAME, "SessionDate_0")||DBGetStringT(NULL, __INTERNAL_NAME, "UserSessionDsc_0")) + { g_hDlg=CreateDialog(hinstance,MAKEINTRESOURCE(IDD_WLCMDIALOG), 0, LoadSessionDlgProc); return 0; } @@ -578,7 +577,7 @@ int SaveUserSessionName(TCHAR *szUSessionName) TCHAR *ptr=NULL; if(session_list[0]!=0) - { + { szUserSessionName = mir_tstrdup(szUSessionName); mir_snprintf(szUserSessionNameBuf, SIZEOF(szUserSessionNameBuf), "%s_%u", "UserSessionDsc", 0); if (!DBGetContactSettingTString(NULL, __INTERNAL_NAME, szUserSessionNameBuf, &dbv)) @@ -599,24 +598,24 @@ int SaveUserSessionName(TCHAR *szUSessionName) } INT_PTR LoadLastSession(WPARAM wparam,LPARAM lparam) -{ +{ int ret=0; if(isLastTRUE) ret=LoadSession(wparam,lparam); - else if (g_bOtherWarnings) + else if (g_bOtherWarnings) MessageBox(NULL, TranslateT("Last Sessions is empty"), TranslateT("Sessions Manager"), MB_OK); return ret; } int LoadSession(WPARAM wparam,LPARAM lparam) -{ +{ int dup=0; int hidden[255]={'0'}; HANDLE hContact; DWORD session_list_t[255]={0}; int mode=0; int i=0,j=0; - if ((UINT)lparam>=ses_limit&&lparam!=256) + if ((UINT)lparam>=ses_limit&&lparam!=256) { mode=1; lparam-=ses_limit; @@ -626,7 +625,7 @@ int LoadSession(WPARAM wparam,LPARAM lparam) else for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) - { + { if(LoadContactsFromMask(hContact,mode,lparam)) { i=GetInSessionOrder(hContact,mode, lparam); @@ -637,10 +636,10 @@ int LoadSession(WPARAM wparam,LPARAM lparam) //TODO: change to "switch" while(session_list_t[i]!=0) { - if (CheckForDuplicate(session_list,session_list_t[i])==-1) + if (CheckForDuplicate(session_list,session_list_t[i])==-1) CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)session_list_t[i], 0); else if(g_bWarnOnHidden) - { + { if (!CheckContactVisibility((HANDLE)session_list_t[i])) { hidden[j]=i+1; @@ -652,7 +651,7 @@ int LoadSession(WPARAM wparam,LPARAM lparam) } if(i==0) - { + { if(g_bOtherWarnings) MessageBox(NULL, TranslateT("No contacts to open"), TranslateT("Sessions Manager"), MB_OK|MB_ICONWARNING); return 1; @@ -660,7 +659,7 @@ int LoadSession(WPARAM wparam,LPARAM lparam) else if(dup==i) { if (!hidden) - { + { if(g_bOtherWarnings) MessageBox(NULL, TranslateT("This Session already opened"), TranslateT("Sessions Manager"), MB_OK|MB_ICONWARNING); return 1; @@ -696,19 +695,19 @@ int DelUserDefSession(int ses_count) for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) - { + { RemoveSessionMark(hContact,1,ses_count); SetInSessionOrder(hContact,1,ses_count,0); } mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", ses_count); DBDeleteContactSetting(NULL, __INTERNAL_NAME, szSessionName); - + mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "FavUserSession", ses_count); DBDeleteContactSetting(NULL, __INTERNAL_NAME, szSessionName); for (i=(ses_count+1);;i++) - { + { mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "UserSessionDsc", i); if ((szSessionNameBuf=DBGetStringT(NULL, __INTERNAL_NAME, szSessionName))/*&&(szSessionHandlesBuf=DBGetStringT(NULL,PLGNAME,szSessionHandles))*/) @@ -743,7 +742,7 @@ int DeleteAutoSession(int ses_count) for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) - { + { RemoveSessionMark(hContact,0,ses_count); SetInSessionOrder(hContact,0,ses_count,0); } @@ -752,7 +751,7 @@ int DeleteAutoSession(int ses_count) DBDeleteContactSetting(NULL, __INTERNAL_NAME, szSessionName); for (i=(ses_count+1);;i++) - { + { mir_snprintf(szSessionName, SIZEOF(szSessionName), "%s_%u", "SessionDate", i); if ((szSessionNameBuf=DBGetStringT(NULL, __INTERNAL_NAME, szSessionName))/*&&(szSessionHandlesBuf=DBGetStringT(NULL,PLGNAME,szSessionHandles))*/) @@ -773,7 +772,7 @@ int DeleteAutoSession(int ses_count) } int SessionPreShutdown(WPARAM wparam,LPARAM lparam) -{ +{ DONT=1; if (hEventDbWindowEvent) UnhookEvent(hEventDbWindowEvent); DestroyServiceFunction(hServiceOpenManager); @@ -790,7 +789,7 @@ int SessionPreShutdown(WPARAM wparam,LPARAM lparam) if (g_hDlg) DestroyWindow(g_hDlg); if (g_hSDlg) DestroyWindow(g_hSDlg); - + DestroyIcon(hiSessions); DestroyIcon(hiSessionsLoad); DestroyIcon(hiSessionsSave); @@ -813,7 +812,7 @@ int SessionPreShutdown(WPARAM wparam,LPARAM lparam) } int OkToExit(WPARAM wparam,LPARAM lparam) -{ +{ int exitmode=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "ShutdownMode", 2); DONT=1; if(exitmode==2&&session_list[0]!=0) @@ -879,7 +878,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) g_ses_count=DBGetContactSettingByte(0, __INTERNAL_NAME, "UserSessionsCount", 0); if (!g_ses_count) g_ses_count=DBGetContactSettingByte(0, "Sessions (Unicode)", "UserSessionsCount", 0); ses_limit=DBGetContactSettingByte(0, __INTERNAL_NAME, "TrackCount", 10); - g_bExclHidden=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "ExclHidden", 0); + g_bExclHidden=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "ExclHidden", 0); g_bWarnOnHidden=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "WarnOnHidden", 0); g_bOtherWarnings=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "OtherWarnings", 1); g_bCrashRecovery=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "CrashRecovery", 0); @@ -893,7 +892,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) int i=0; HANDLE hContact; ZeroMemory(session_list_recovered,255); - + for (hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) { @@ -909,7 +908,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) startup=DBGetContactSettingByte(NULL, __INTERNAL_NAME, "StartupMode", 3); if (startup==1||(startup==3&&isLastTRUE==TRUE)) - { + { StartUp=TRUE; g_hDlg=CreateDialog(hinstance,MAKEINTRESOURCE(IDD_WLCMDIALOG), 0, LoadSessionDlgProc); } @@ -993,36 +992,36 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) if (ServiceExists(MS_TB_ADDBUTTON)) { - TBButton button = {0}; - button.defPos = 102200; - button.tbbFlags = TBBF_SHOWTOOLTIP|TBBF_VISIBLE; + TBButton button = {0}; + button.defPos = 102200; + button.tbbFlags = TBBF_SHOWTOOLTIP|TBBF_VISIBLE; button.pszButtonID = MS_SESSIONS_OPENMANAGER; - button.pszServiceName = MS_SESSIONS_OPENMANAGER; + button.pszServiceName = MS_SESSIONS_OPENMANAGER; button.pszTooltipUp = button.pszTooltipUp = button.pszButtonName = "Open Sessions Manager"; - button.hSecondaryIconHandle = button.hPrimaryIconHandle = hibSessionsLoad; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); - button.defPos++; + button.hSecondaryIconHandle = button.hPrimaryIconHandle = hibSessionsLoad; + CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); + button.defPos++; button.pszButtonID = MS_SESSIONS_SAVEUSERSESSION; - button.pszServiceName = MS_SESSIONS_SAVEUSERSESSION; + button.pszServiceName = MS_SESSIONS_SAVEUSERSESSION; button.pszTooltipUp = button.pszTooltipUp = button.pszButtonName = "Save Session"; - button.hSecondaryIconHandle = button.hPrimaryIconHandle = hibSessionsSave; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); - button.defPos++; + button.hSecondaryIconHandle = button.hPrimaryIconHandle = hibSessionsSave; + CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); + button.defPos++; button.pszButtonID = MS_SESSIONS_RESTORELASTSESSION; - button.pszServiceName = MS_SESSIONS_RESTORELASTSESSION; + button.pszServiceName = MS_SESSIONS_RESTORELASTSESSION; button.pszTooltipUp = button.pszTooltipUp = button.pszButtonName = "Restore Last Session"; - button.hSecondaryIconHandle = button.hPrimaryIconHandle = hibSessionsLoadLast; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); - button.defPos++; - + button.hSecondaryIconHandle = button.hPrimaryIconHandle = hibSessionsLoadLast; + CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); + button.defPos++; + button.pszButtonID = MS_SESSIONS_SHOWFAVORITESMENU; - button.pszServiceName = MS_SESSIONS_SHOWFAVORITESMENU; + button.pszServiceName = MS_SESSIONS_SHOWFAVORITESMENU; button.pszTooltipUp = button.pszTooltipUp = button.pszButtonName = "Show Favorite Sessions Menu"; - button.hSecondaryIconHandle = button.hPrimaryIconHandle = hibChecked; - CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); + button.hSecondaryIconHandle = button.hPrimaryIconHandle = hibChecked; + CallService(MS_TB_ADDBUTTON, 0, (LPARAM)&button); } if(ServiceExists(MS_UPDATE_REGISTER)) @@ -1068,9 +1067,8 @@ BOOL WINAPI DllMain(HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved) } extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) -{ +{ pluginLink=link; - mir_getMMI(&mmi); mir_getLP(&pluginInfo); hEventDbPluginsLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit); diff --git a/plugins/SimpleAR/Src/Main.cpp b/plugins/SimpleAR/Src/Main.cpp index 9fe60e4199..4491918d58 100644 --- a/plugins/SimpleAR/Src/Main.cpp +++ b/plugins/SimpleAR/Src/Main.cpp @@ -23,8 +23,6 @@ HANDLE hToggle = NULL, hEnableMenu = NULL; CLISTMENUITEM mi; BOOL fEnabled, gbVarsServiceExist = FALSE; INT interval; -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; int hLangpack; TCHAR* ptszDefaultMsg[]={ @@ -318,8 +316,6 @@ INT OnPreShutdown(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport)Load(PLUGINLINK *link) { pluginLink=link; - mir_getMMI(&mmi); - mir_getUTFI(&utfi); mir_getLP(&pluginInfoEx); hToggleEnable = CreateServiceFunction(protocolname"/ToggleEnable", ToggleEnable); diff --git a/plugins/SimpleStatusMsg/main.cpp b/plugins/SimpleStatusMsg/main.cpp index ae103b715a..4ed01bfeb0 100644 --- a/plugins/SimpleStatusMsg/main.cpp +++ b/plugins/SimpleStatusMsg/main.cpp @@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc., HINSTANCE g_hInst; PLUGINLINK *pluginLink; int hLangpack; -struct MM_INTERFACE mmi; PROTOACCOUNTS *accounts; static int g_iIdleTime = -1; @@ -2165,8 +2164,6 @@ static INT_PTR sttGetAwayMessage(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - - mir_getMMI(&mmi); mir_getLP(&pluginInfo); hwndSAMsgDialog = NULL; accounts = (PROTOACCOUNTS *)mir_alloc(sizeof(PROTOACCOUNTS)); diff --git a/plugins/SmileyAdd/main.cpp b/plugins/SmileyAdd/main.cpp index e647b694c2..8c041ea78b 100644 --- a/plugins/SmileyAdd/main.cpp +++ b/plugins/SmileyAdd/main.cpp @@ -41,9 +41,6 @@ static HANDLE hHooks[7]; static HANDLE hService[13]; int hLangpack; -MM_INTERFACE mmi; -LIST_INTERFACE li; -UTF8_INTERFACE utfi; static const PLUGININFOEX pluginInfoEx = { @@ -123,10 +120,6 @@ static int MirandaShutdown(WPARAM, LPARAM) extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; - - mir_getLI(&li); - mir_getMMI(&mmi); - mir_getUTFI(&utfi); mir_getLP(&pluginInfoEx); if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) diff --git a/plugins/SpellChecker/spellchecker.cpp b/plugins/SpellChecker/spellchecker.cpp index d5ed23c822..c1f246337e 100644 --- a/plugins/SpellChecker/spellchecker.cpp +++ b/plugins/SpellChecker/spellchecker.cpp @@ -59,9 +59,6 @@ static IconStruct iconList[] = HINSTANCE hInst; PLUGINLINK *pluginLink; -LIST_INTERFACE li; -MM_INTERFACE mmi; -UTF8_INTERFACE utfi; int hLangpack = 0; HANDLE hHooks[6]; @@ -159,10 +156,6 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - - mir_getMMI(&mmi); - mir_getUTFI(&utfi); - mir_getLI(&li); mir_getLP(&pluginInfo); // hooks diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp index 495d1969dc..d2024b8606 100644 --- a/plugins/SplashScreen/src/main.cpp +++ b/plugins/SplashScreen/src/main.cpp @@ -27,7 +27,6 @@ HINSTANCE hInst = 0; PLUGINLINK *pluginLink; -struct MM_INTERFACE mmi; int hLangpack; static HMODULE hUserDll = NULL; @@ -396,9 +395,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getLP(&pluginInfo); - mir_getMMI(&mmi); - + mir_getLP(&pluginInfo); hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); hSystemOKToExit = HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit); diff --git a/plugins/StatusPlugins/AdvancedAutoAway/main.cpp b/plugins/StatusPlugins/AdvancedAutoAway/main.cpp index 9005e3d619..cc2887ce96 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/main.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/main.cpp @@ -30,8 +30,6 @@ HINSTANCE hInst; PLUGINLINK *pluginLink; -MM_INTERFACE mmi; -LIST_INTERFACE li; HANDLE hCSModuleLoadedHook; HANDLE hStateChangedEvent; @@ -76,8 +74,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI(&mmi); - mir_getLI(&li); mir_getLP( &pluginInfoEx ); InitCommonStatus(); diff --git a/plugins/StatusPlugins/KeepStatus/main.cpp b/plugins/StatusPlugins/KeepStatus/main.cpp index 3d79983cd4..af840be01d 100644 --- a/plugins/StatusPlugins/KeepStatus/main.cpp +++ b/plugins/StatusPlugins/KeepStatus/main.cpp @@ -30,8 +30,6 @@ HANDLE hCSModuleLoadedHook = NULL; HANDLE hConnectionEvent = NULL; HANDLE hStopRecon = NULL, hEnableProto = NULL, hIsProtoEnabled = NULL, hAnnounceStat = NULL; -MM_INTERFACE mmi; -LIST_INTERFACE li; HINSTANCE hInst; PLUGINLINK *pluginLink; @@ -83,8 +81,6 @@ INT_PTR AnnounceStatusChangeService(WPARAM wParam, LPARAM lParam); extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI( &mmi ); - mir_getLI( &li ); mir_getLP( &pluginInfoEx ); InitCommonStatus(); diff --git a/plugins/StatusPlugins/StartupStatus/main.cpp b/plugins/StatusPlugins/StartupStatus/main.cpp index da09885072..ece3eef5c9 100644 --- a/plugins/StatusPlugins/StartupStatus/main.cpp +++ b/plugins/StatusPlugins/StartupStatus/main.cpp @@ -31,8 +31,6 @@ static HANDLE HINSTANCE hInst; PLUGINLINK *pluginLink; -MM_INTERFACE mmi; -LIST_INTERFACE li; int hLangpack = 0; int CSModuleLoaded( WPARAM, LPARAM ); @@ -78,8 +76,6 @@ static INT_PTR SrvGetProfile( WPARAM wParam, LPARAM lParam ) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI(&mmi); - mir_getLI(&li); mir_getLP( &pluginInfoEx ); if ( DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETPROFILE, 1) || diff --git a/plugins/StopSpamPlus/src/stopspam.cpp b/plugins/StopSpamPlus/src/stopspam.cpp index b7f1419c29..bf91c6b222 100644 --- a/plugins/StopSpamPlus/src/stopspam.cpp +++ b/plugins/StopSpamPlus/src/stopspam.cpp @@ -1,7 +1,5 @@ #include "../headers.h" -struct MM_INTERFACE mmi; -UTF8_INTERFACE utfi; HANDLE hFunc, hTempRemove, hLoadHook; int hLangpack; @@ -48,10 +46,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { CLISTMENUITEM mi; pluginLink = link; - mir_getLP(&pluginInfoEx); - mir_getMMI(&mmi); - mir_getUTFI(&utfi); - + mir_getLP(&pluginInfoEx); plSets=new Settings; hFunc = CreateServiceFunction(MS_STOPSPAM_CONTACTPASSED, IsContactPassed); diff --git a/plugins/Svc_crshdmp/crshdmp.cpp b/plugins/Svc_crshdmp/crshdmp.cpp index e0935bcdb6..13cb675699 100644 --- a/plugins/Svc_crshdmp/crshdmp.cpp +++ b/plugins/Svc_crshdmp/crshdmp.cpp @@ -22,10 +22,6 @@ along with this program. If not, see . #include "m_toolbar.h" #include "version.h" -MM_INTERFACE mmi; -MD5_INTERFACE md5i; -UTF8_INTERFACE utfi; - int hLangpack; HINSTANCE hInst; @@ -400,10 +396,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) clsdates = DBGetContactSettingByte(NULL, PluginName, "ClassicDates", 1) != 0; dtsubfldr = DBGetContactSettingByte(NULL, PluginName, "SubFolders", 1) != 0; - - mir_getMMI(&mmi); - mir_getMD5I(&md5i); - mir_getUTFI(&utfi); mir_getLP(&pluginInfoEx); hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); diff --git a/plugins/Svc_dbepp/main.cpp b/plugins/Svc_dbepp/main.cpp index c1507b3797..2207bbe934 100644 --- a/plugins/Svc_dbepp/main.cpp +++ b/plugins/Svc_dbepp/main.cpp @@ -6,8 +6,6 @@ PLUGINLINK *pluginLink; HINSTANCE hInst = NULL; -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; HANDLE hTTBButt = NULL; BOOL bServiceMode = FALSE; BOOL usePopUps; @@ -297,8 +295,6 @@ INT_PTR ImportFromFile(WPARAM wParam,LPARAM lParam) extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI(&mmi); - mir_getUTFI( &utfi ); mir_getLP(&pluginInfoEx); hwnd2mainWindow = 0; diff --git a/plugins/Svc_vi/main.cpp b/plugins/Svc_vi/main.cpp index 207e4fc433..b237142329 100644 --- a/plugins/Svc_vi/main.cpp +++ b/plugins/Svc_vi/main.cpp @@ -30,8 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE hInst; PLUGINLINK *pluginLink; int hLangpack; -MM_INTERFACE mmi; -UTF8_INTERFACE utfi; HICON hiVIIcon; @@ -89,10 +87,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink=link; - mir_getLP(&pluginInfo); - mir_getMMI(&mmi); - mir_getUTFI(&utfi); - + mir_getLP(&pluginInfo); InitServices(); HookEvents(); diff --git a/plugins/TabSRMM/src/commonheaders.h b/plugins/TabSRMM/src/commonheaders.h index a42af77b50..e9ea841762 100644 --- a/plugins/TabSRMM/src/commonheaders.h +++ b/plugins/TabSRMM/src/commonheaders.h @@ -208,8 +208,6 @@ #include #include -extern struct LIST_INTERFACE li; - #define safe_sizeof(a) (unsigned int)((sizeof((a)) / sizeof((a)[0]))) #include "../include/version.h" diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index 7e009b436b..6aefbcf8bc 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -48,8 +48,6 @@ LOGFONT lfDefault = {0}; * miranda interfaces */ -struct LIST_INTERFACE li; -struct MM_INTERFACE mmi; int hLangpack; TIME_API tmi = {0}; @@ -97,9 +95,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK * link) } pluginLink = link; - - mir_getMMI(&mmi); - mir_getLI(&li); mir_getTMI(&tmi); mir_getLP(&pluginInfo); diff --git a/plugins/TipperYM/common.h b/plugins/TipperYM/common.h index 201f8740c5..317796ed7f 100644 --- a/plugins/TipperYM/common.h +++ b/plugins/TipperYM/common.h @@ -15,7 +15,7 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this file; see the file license.txt. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. +Boston, MA 02111-1307, USA. */ #pragma once @@ -26,9 +26,9 @@ Boston, MA 02111-1307, USA. #define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. +#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif +#endif #ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. @@ -102,6 +102,4 @@ extern COLORREF colTitle, colLabels, colBg, colValues; extern int iCodePage; extern char szMetaModuleName[256]; -extern MM_INTERFACE mmi; -extern LIST_INTERFACE li; extern FI_INTERFACE *fii; \ No newline at end of file diff --git a/plugins/TipperYM/tipper.cpp b/plugins/TipperYM/tipper.cpp index 09903c4302..788836da85 100644 --- a/plugins/TipperYM/tipper.cpp +++ b/plugins/TipperYM/tipper.cpp @@ -15,7 +15,7 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this file; see the file license.txt. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. +Boston, MA 02111-1307, USA. */ #include "common.h" @@ -35,7 +35,7 @@ ColourIDT colourBg, colourBorder, colourAvatarBorder, colourDivider, colourSideb HFONT hFontTitle, hFontLabels, hFontValues, hFontTrayTitle; // hooked here so it's in the main thread -HANDLE hAvChangeEvent, hShowTipEvent, hHideTipEvent, hAckEvent, hFramesSBShow, hFramesSBHide; +HANDLE hAvChangeEvent, hShowTipEvent, hHideTipEvent, hAckEvent, hFramesSBShow, hFramesSBHide; HANDLE hSettingChangedEvent, hEventDeleted; HANDLE hShowTipService, hShowTipWService, hHideTipService; HANDLE hReloadFonts = NULL; @@ -44,12 +44,10 @@ HANDLE hFolderChanged, hSkinFolder; TCHAR SKIN_FOLDER[256]; FI_INTERFACE *fii = NULL; -MM_INTERFACE mmi; -LIST_INTERFACE li; TIME_API tmi; int hLangpack; -PLUGININFOEX pluginInfoEx = +PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), "Tipper YM", @@ -82,7 +80,7 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) return interfaces; } -int ReloadFont(WPARAM wParam, LPARAM lParam) +int ReloadFont(WPARAM wParam, LPARAM lParam) { LOGFONT logFont; if (hFontTitle) DeleteObject(hFontTitle); @@ -109,25 +107,25 @@ int ReloadFont(WPARAM wParam, LPARAM lParam) // hack to hide tip when clist hides from timeout -int SettingChanged(WPARAM wParam, LPARAM lParam) +int SettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *dcws = (DBCONTACTWRITESETTING *)lParam; - if (strcmp(dcws->szModule, "CList") != 0 || strcmp(dcws->szSetting, "State") != 0) + if (strcmp(dcws->szModule, "CList") != 0 || strcmp(dcws->szSetting, "State") != 0) return 0; // clist hiding if (dcws->value.type == DBVT_BYTE && dcws->value.bVal == 0) - HideTip(0, 0); + HideTip(0, 0); return 0; } // needed for msg_count_xxx substitutions -int EventDeleted(WPARAM wParam, LPARAM lParam) +int EventDeleted(WPARAM wParam, LPARAM lParam) { DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); - if (!CallService(MS_DB_EVENT_GET, lParam, (LPARAM)&dbei)) + if (!CallService(MS_DB_EVENT_GET, lParam, (LPARAM)&dbei)) { if (dbei.eventType == EVENTTYPE_MESSAGE) DBDeleteContactSetting((HANDLE)wParam, MODULE, "LastCountTS"); @@ -264,7 +262,7 @@ void InitFonts() void InitUpdaterSupport() { #ifndef _WIN64 - if (ServiceExists(MS_UPDATE_REGISTER)) + if (ServiceExists(MS_UPDATE_REGISTER)) { Update update = {0}; char szVersion[16]; @@ -284,7 +282,7 @@ void InitUpdaterSupport() #endif } -int ModulesLoaded(WPARAM wParam, LPARAM lParam) +int ModulesLoaded(WPARAM wParam, LPARAM lParam) { InitFonts(); InitUpdaterSupport(); @@ -303,7 +301,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, SIZEOF(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER)); InitTipperSmileys(); - LoadOptions(); + LoadOptions(); ReloadFont(0, 0); ParseSkinFile(opt.szSkinName, true, false); @@ -320,7 +318,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) return 0; } -int Shutdown(WPARAM wParam, LPARAM lParam) +int Shutdown(WPARAM wParam, LPARAM lParam) { if (hFramesSBShow) UnhookEvent(hFramesSBShow); if (hFramesSBHide) UnhookEvent(hFramesSBHide); @@ -343,16 +341,10 @@ int Shutdown(WPARAM wParam, LPARAM lParam) HANDLE hEventPreShutdown, hEventModulesLoaded; -extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) +extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - if (mir_getMMI(&mmi) || mir_getLI(&li) || !ServiceExists(MS_IMG_GETINTERFACE)) - { - MessageBox(NULL, TranslateT("Cannot obtain required interfaces!\nTooltips will not be available until you upgrade Miranda IM to the newest version."), TranslateT("Tipper error"), MB_OK | MB_ICONSTOP); - return 1; - } - CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fii); mir_getTMI(&tmi); mir_getLP(&pluginInfoEx); @@ -376,11 +368,11 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) hSettingChangedEvent = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged); hEventDeleted = HookEvent(ME_DB_EVENT_DELETED, EventDeleted); - + return 0; } -extern "C" int __declspec(dllexport) Unload() +extern "C" int __declspec(dllexport) Unload() { UnhookEvent(hSettingChangedEvent); UnhookEvent(hEventDeleted); diff --git a/plugins/TopToolBar/main.cpp b/plugins/TopToolBar/main.cpp index d4f486bbe0..91b41be6cc 100644 --- a/plugins/TopToolBar/main.cpp +++ b/plugins/TopToolBar/main.cpp @@ -4,8 +4,6 @@ HINSTANCE hInst; PLUGINLINK *pluginLink; -MM_INTERFACE mmi; -LIST_INTERFACE li; HANDLE hHookTTBModuleLoaded; int hLangpack; @@ -46,8 +44,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI( &mmi ); - mir_getLI( &li ); mir_getLP(&pluginInfo); LoadToolbarModule(); diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp index 17e5028df0..7161d26c9b 100644 --- a/plugins/TopToolBar/toolbar.cpp +++ b/plugins/TopToolBar/toolbar.cpp @@ -185,7 +185,9 @@ INT_PTR TTBRemoveButton(WPARAM wParam, LPARAM lParam) RemoveFromOptions(b->id); - Buttons.remove(b); + int idx = Buttons.getIndex(b); + if (idx != -1) + Buttons.remove(idx); delete b; ArrangeButtons(); diff --git a/plugins/TranslitSwitcher/Src/TranslitSwitcher.cpp b/plugins/TranslitSwitcher/Src/TranslitSwitcher.cpp index e762b2a5a0..f401467bce 100644 --- a/plugins/TranslitSwitcher/Src/TranslitSwitcher.cpp +++ b/plugins/TranslitSwitcher/Src/TranslitSwitcher.cpp @@ -21,8 +21,6 @@ Boston, MA 02111-1307, USA. HINSTANCE hInst = NULL; PLUGINLINK *pluginLink; -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; HANDLE hOnButtonPressed; int hLangpack; @@ -188,8 +186,6 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI(&mmi); - mir_getUTFI(&utfi); mir_getLP(&pluginInfoEx); hHook = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); diff --git a/plugins/Updater/updater.cpp b/plugins/Updater/updater.cpp index 8d6d3f9b2a..fc45f42ab2 100644 --- a/plugins/Updater/updater.cpp +++ b/plugins/Updater/updater.cpp @@ -10,9 +10,6 @@ PLUGINLINK *pluginLink; HANDLE hNetlibUser, hNetlibHttp; HANDLE hEventOptInit, hEventModulesLoaded, hEventIdleChanged, hToolBarLoaded; -MM_INTERFACE mmi; -UTF8_INTERFACE utfi; -LIST_INTERFACE li; int hLangpack; bool is_idle = false; @@ -217,10 +214,6 @@ static int ToolbarModulesLoaded(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - - mir_getLI(&li); - mir_getMMI(&mmi); - mir_getUTFI(&utfi); mir_getLP(&pluginInfo); // save global status from clist - will be restored after update check if that option is enabled, or in modules loaded if not diff --git a/plugins/UserGuide/main.cpp b/plugins/UserGuide/main.cpp index 908c99e09b..3c560ae61c 100644 --- a/plugins/UserGuide/main.cpp +++ b/plugins/UserGuide/main.cpp @@ -1,6 +1,5 @@ #include "commonheaders.h" -struct MM_INTERFACE mmi; HINSTANCE hInst; PLUGINLINK *pluginLink; HANDLE hModulesLoaded, hShowGuide; @@ -114,7 +113,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI(&mmi); mir_getLP(&pluginInfo); hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded); return 0; diff --git a/plugins/UserInfoEx/commonheaders.cpp b/plugins/UserInfoEx/commonheaders.cpp index f74cb2261e..608d7ddbfc 100644 --- a/plugins/UserInfoEx/commonheaders.cpp +++ b/plugins/UserInfoEx/commonheaders.cpp @@ -31,10 +31,6 @@ Last change by : $Author: ing.u.horn $ // global: HINSTANCE ghInst = NULL; -MM_INTERFACE mmi; //memory interface -UTF8_INTERFACE utfi; //utf8 interface -LIST_INTERFACE li; //list interface -//XML_API xi; //for late use TIME_API tmi; //timezone interface FI_INTERFACE *FIP = NULL; //freeimage interface CLIST_INTERFACE *pcli = NULL; @@ -57,7 +53,7 @@ pfnDwmIsCompositionEnabled dwmIsCompositionEnabled; DWORD hashSetting(LPCSTR szStr) { #if defined _M_IX86 && !defined _NUMEGA_BC_FINALCHECK && !defined NOINLINEASM - __asm + __asm { xor edx,edx xor eax,eax @@ -82,7 +78,7 @@ DWORD hashSetting(LPCSTR szStr) DWORD hash = 0; int i; int shift = 0; - for (i = 0; szStr[i]; i++) + for (i = 0; szStr[i]; i++) { hash ^= szStr[i] << shift; if (shift > 24) @@ -95,7 +91,7 @@ DWORD hashSetting(LPCSTR szStr) #endif } -// MurmurHash2 +// MurmurHash2 #ifdef _DEBUG #pragma optimize( "gt", on ) #endif @@ -116,17 +112,17 @@ unsigned int __fastcall hash_M2(const void * key, unsigned int len) { unsigned int k = *(unsigned int *)data; - k *= m; - k ^= k >> r; - k *= m; - - h *= m; + k *= m; + k ^= k >> r; + k *= m; + + h *= m; h ^= k; data += 4; len -= 4; } - + // Handle the last few bytes of the input array switch(len) { diff --git a/plugins/UserInfoEx/commonheaders.h b/plugins/UserInfoEx/commonheaders.h index de1ac528f8..e7b4f51bad 100644 --- a/plugins/UserInfoEx/commonheaders.h +++ b/plugins/UserInfoEx/commonheaders.h @@ -171,11 +171,7 @@ typedef struct _MGLOBAL extern HINSTANCE ghInst; extern MGLOBAL myGlobals; -extern MM_INTERFACE mmi; -extern LIST_INTERFACE li; -extern UTF8_INTERFACE utfi; -//extern TIME_API tmi; -extern FI_INTERFACE *FIP; +extern FI_INTERFACE* FIP; /*********************************************************************************************************** * MIRANDA_CPP_PLUGIN_API @@ -183,7 +179,7 @@ extern FI_INTERFACE *FIP; /** * These macros provide an interface for classes to use member - * function as services and event hooks. + * function as services and event hooks. * * @note This requires Miranda Core 0.8+! * @@ -236,4 +232,3 @@ static FORCEINLINE BOOLEAN IsAeroMode() BOOL result; return myGlobals.WantAeroAdaption && dwmIsCompositionEnabled && (dwmIsCompositionEnabled(&result) == S_OK) && result; } - diff --git a/plugins/UserInfoEx/init.cpp b/plugins/UserInfoEx/init.cpp index 1cab813504..d1a1a47bcc 100644 --- a/plugins/UserInfoEx/init.cpp +++ b/plugins/UserInfoEx/init.cpp @@ -60,7 +60,7 @@ static PLUGININFOEX pluginInfo = { __AUTHOR, __AUTHOREMAIL, __COPYRIGHT, - __AUTHORWEB, + __AUTHORWEB, UNICODE_AWARE, DEFMOD_UIUSERINFO, MIID_UIUSERINFOEX @@ -89,7 +89,7 @@ PLUGINLINK* pluginLink = NULL; * * @return always 0 **/ -static INT OnTopToolBarLoaded(WPARAM wParam, LPARAM lParam) +static INT OnTopToolBarLoaded(WPARAM wParam, LPARAM lParam) { UnhookEvent(ghTopToolBarLoaded); DlgAnniversaryListOnTopToolBarLoaded(); @@ -106,7 +106,7 @@ static INT OnTopToolBarLoaded(WPARAM wParam, LPARAM lParam) * * @return always 0 **/ -static INT OnModernToolBarLoaded(WPARAM wParam, LPARAM lParam) +static INT OnModernToolBarLoaded(WPARAM wParam, LPARAM lParam) { UnhookEvent(ghModernToolBarLoaded); DlgAnniversaryListOnToolBarLoaded(); @@ -122,15 +122,8 @@ static INT OnModernToolBarLoaded(WPARAM wParam, LPARAM lParam) * * @return always 0 **/ -static INT OnModulesLoaded(WPARAM wParam, LPARAM lParam) +static INT OnModulesLoaded(WPARAM wParam, LPARAM lParam) { -#ifdef _DEBUG - #define new DEBUG_NEW; - int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); - tmpFlag |= _CRTDBG_LEAK_CHECK_DF; - _CrtSetDbgFlag(tmpFlag); -// _CrtSetBreakAlloc(4852); -#endif INT_PTR ptr; UnhookEvent(ghModulesLoadedHook); @@ -160,13 +153,13 @@ static INT OnModulesLoaded(WPARAM wParam, LPARAM lParam) #ifdef _DEBUG // new feature, not in release jet NServices::NAvatar::OnModulesLoaded(); #endif - + // build contact's menuitems RebuildMenu(); ghPrebuildStatusMenu = HookEvent( ME_CLIST_PREBUILDSTATUSMENU, (MIRANDAHOOK)RebuildAccount); // finally register for updater - if (ServiceExists(MS_UPDATE_REGISTER)) + if (ServiceExists(MS_UPDATE_REGISTER)) { Update update = {0}; CHAR szVersion[16]; @@ -176,7 +169,7 @@ static INT OnModulesLoaded(WPARAM wParam, LPARAM lParam) update.cpbVersion = (INT)strlen((LPSTR)update.pbVersion); update.szUpdateURL = UPDATER_AUTOREGISTER; - + update.szBetaVersionURL = "http://userinfoex.googlecode.com/svn/trunk/changelog.txt"; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data // e.g. change '[0.8.1.0 (in work)]' to 'UserinfoEx: 0.8.1.0' for beta versions bump @@ -243,7 +236,7 @@ static BOOL CoreCheck() bOk *= (GetVersion() & 0x80000000) == 0; bOk *= strstr(szVer, "unicode") != 0; - + bOk *= _tcsstr(_tcsrchr(tszExePath, '\\'), _T("miranda")) != 0; bOk *= !strstr(szVer, "coffee") && strncmp(szVer, "1.", 2) && !strstr(szVer, " 1."); bOk *= myGlobals.mirandaVersion < PLUGIN_MAKE_VERSION(1,0,0,0); @@ -261,7 +254,7 @@ static BOOL CoreCheck() * * @return pointer to pluginInfo struct **/ -extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion) { myGlobals.mirandaVersion = mirandaVersion; return &pluginInfo; @@ -277,7 +270,7 @@ extern "C" __declspec(dllexport) const MUUID *MirandaPluginInterfaces() static const MUUID interfaces[] = { MIID_UIUSERINFOEX, // this is just me MIID_UIUSERINFO, // replace the default userinfo module - MIID_CONTACTINFO, // indicate, that MS_CONTACT_GETCONTACTINFO service is provided + MIID_CONTACTINFO, // indicate, that MS_CONTACT_GETCONTACTINFO service is provided MIID_REMINDER, // indicate an Reminder of being provided MIID_SREMAIL, // Send/Receive E-Mail service is provided MIID_LAST @@ -315,66 +308,59 @@ extern "C" INT __declspec(dllexport) Load(PLUGINLINK *link) ZeroMemory(&myGlobals, sizeof(MGLOBAL)); - // init miranda's memory interface - if (!mir_getMMI(&mmi) && !mir_getLI(&li) && !mir_getUTFI(&utfi) /*&& mir_getXI(&xi)*/) - { + // init clist interface + pcli = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)0); + + // init new miranda timezone interface + mir_getTMI(&tmi); - // init clist interface - pcli = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)0); - - // init new miranda timezone interface - mir_getTMI(&tmi); - - // init freeimage interface - INT_PTR result = CALLSERVICE_NOTFOUND; - if(ServiceExists(MS_IMG_GETINTERFACE)) - result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP); - - if(FIP == NULL || result != S_OK) { - MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. Flags Module will be disabled."), _T("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0); - return 1; - } - - if (IsWinVerVistaPlus()) - { - HMODULE hDwmApi = LoadLibraryA("dwmapi.dll"); - if (hDwmApi) - { - dwmIsCompositionEnabled = (pfnDwmIsCompositionEnabled)GetProcAddress(hDwmApi,"DwmIsCompositionEnabled"); - } - } - - // check for dbx_tree - myGlobals.UseDbxTree = ServiceExists("DBT/Entity/GetRoot"); - - // load icon library - IcoLib_LoadModule(); - - SvcFlagsLoadModule(); - tmi.getTimeZoneTime ? SvcTimezoneLoadModule() : SvcTimezoneLoadModule_old(); - SvcContactInfoLoadModule(); - SvcEMailLoadModule(); - SvcRefreshContactInfoLoadModule(); - - CtrlContactLoadModule(); - // load my button class - CtrlButtonLoadModule(); - // initializes the Ex/Import Services - SvcExImport_LoadModule(); - // load the UserInfoPropertySheet module - DlgContactInfoLoadModule(); - - // Anniversary stuff - DlgAnniversaryListLoadModule(); - SvcReminderLoadModule(); - - // Now the module is loaded! Start initializing certain things - ghModulesLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - ghTopToolBarLoaded = HookEvent(ME_TTB_MODULELOADED, OnTopToolBarLoaded); - ghModernToolBarLoaded = HookEvent(ME_TB_MODULELOADED, OnModernToolBarLoaded); - ghShutdownHook = HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); - return 0; + // init freeimage interface + INT_PTR result = CALLSERVICE_NOTFOUND; + if(ServiceExists(MS_IMG_GETINTERFACE)) + result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP); + + if(FIP == NULL || result != S_OK) { + MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. Flags Module will be disabled."), _T("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0); + return 1; + } + + if (IsWinVerVistaPlus()) + { + HMODULE hDwmApi = LoadLibraryA("dwmapi.dll"); + if (hDwmApi) + dwmIsCompositionEnabled = (pfnDwmIsCompositionEnabled)GetProcAddress(hDwmApi,"DwmIsCompositionEnabled"); } + + // check for dbx_tree + myGlobals.UseDbxTree = ServiceExists("DBT/Entity/GetRoot"); + + // load icon library + IcoLib_LoadModule(); + + SvcFlagsLoadModule(); + tmi.getTimeZoneTime ? SvcTimezoneLoadModule() : SvcTimezoneLoadModule_old(); + SvcContactInfoLoadModule(); + SvcEMailLoadModule(); + SvcRefreshContactInfoLoadModule(); + + CtrlContactLoadModule(); + // load my button class + CtrlButtonLoadModule(); + // initializes the Ex/Import Services + SvcExImport_LoadModule(); + // load the UserInfoPropertySheet module + DlgContactInfoLoadModule(); + + // Anniversary stuff + DlgAnniversaryListLoadModule(); + SvcReminderLoadModule(); + + // Now the module is loaded! Start initializing certain things + ghModulesLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + ghTopToolBarLoaded = HookEvent(ME_TTB_MODULELOADED, OnTopToolBarLoaded); + ghModernToolBarLoaded = HookEvent(ME_TB_MODULELOADED, OnModernToolBarLoaded); + ghShutdownHook = HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); + return 0; } return 1; } @@ -393,4 +379,3 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved) } return TRUE; } - diff --git a/plugins/Utils/mir_dblists.cpp b/plugins/Utils/mir_dblists.cpp index a1711eda4b..e866589b24 100644 --- a/plugins/Utils/mir_dblists.cpp +++ b/plugins/Utils/mir_dblists.cpp @@ -14,7 +14,7 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this file; see the file license.txt. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. +Boston, MA 02111-1307, USA. */ @@ -27,16 +27,6 @@ Boston, MA 02111-1307, USA. #include -struct LIST_INTERFACE list_interface = {0}; - - -void init_list_interface() -{ - list_interface.cbSize = sizeof(list_interface); - CallService(MS_SYSTEM_GET_LI, 0, (LPARAM)&list_interface); -} - - void List_DestroyFreeContents( SortedList* p_list ) { if ( p_list == NULL ) @@ -58,7 +48,7 @@ void List_DestroyFreeContents( SortedList* p_list ) } -int List_Append( SortedList* p_list, void* p_value ) +int List_Append( SortedList* p_list, void* p_value ) { return List_Insert( p_list, p_value, p_list->realCount ); } diff --git a/plugins/Utils/mir_dblists.h b/plugins/Utils/mir_dblists.h index 4d4552b49d..f9a5092327 100644 --- a/plugins/Utils/mir_dblists.h +++ b/plugins/Utils/mir_dblists.h @@ -14,7 +14,7 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this file; see the file license.txt. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. +Boston, MA 02111-1307, USA. */ @@ -25,23 +25,7 @@ Boston, MA 02111-1307, USA. #include #include - - -extern struct LIST_INTERFACE list_interface; - - // Need to be called on ME_SYSTEM_MODULESLOADED -void init_list_interface(); - - -#define List_Create(x,y) (list_interface.List_Create(x,y)) -#define List_Destroy(x) (list_interface.List_Destroy(x)) -#define List_Find(x,y) (list_interface.List_Find(x,y)) -#define List_GetIndex(x,y,z) (list_interface.List_GetIndex(x,y,z)) -#define List_Insert(x,y,z) (list_interface.List_Insert(x,y,z)) -#define List_Remove(x,y) (list_interface.List_Remove(x,y)) -#define List_IndexOf(x,y) (list_interface.List_IndexOf(x,y)) - BOOL List_HasItens( SortedList* p_list ); diff --git a/plugins/Variables/main.cpp b/plugins/Variables/main.cpp index ae3125ed91..6db64cf7ef 100644 --- a/plugins/Variables/main.cpp +++ b/plugins/Variables/main.cpp @@ -20,8 +20,6 @@ #include "buildnumber.h" HINSTANCE hInst; -struct MM_INTERFACE mmi; -struct LIST_INTERFACE li; PLUGINLINK *pluginLink; DWORD g_mirandaVersion; int hLangpack = 0; @@ -85,9 +83,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) pluginLink = link; if (UnicodeCheck(pluginInfoEx.shortName, FALSE)) return 0; - - mir_getMMI( &mmi ); - mir_getLI( &li ); mir_getLP( &pluginInfoEx ); hExitHook = HookEvent(ME_SYSTEM_OKTOEXIT, Exit); diff --git a/plugins/Variables/tokenregister.cpp b/plugins/Variables/tokenregister.cpp index 54a40a5147..50c81ddad8 100644 --- a/plugins/Variables/tokenregister.cpp +++ b/plugins/Variables/tokenregister.cpp @@ -18,8 +18,6 @@ */ #include "variables.h" -extern struct LIST_INTERFACE li; - typedef struct { TOKENREGISTEREX tr; DWORD nameHash; @@ -50,7 +48,7 @@ static TokenRegisterEntry* FindTokenRegisterByName(TCHAR *name) temp.nameHash = NameHashFunction( name ); if ( List_GetIndex(( SortedList* )&tokens, &temp, &idx )) return tokens.items[ idx ]; - + return NULL; } @@ -68,12 +66,12 @@ int registerIntToken(TCHAR *szToken, TCHAR *(*parseFunction)(ARGUMENTSINFO *ai), } int deRegisterToken(TCHAR *token) { - + TokenRegisterEntry *tre; - + if (token == NULL) { return -1; - } + } EnterCriticalSection(&csRegister); tre = FindTokenRegisterByName( token ); if ( tre == NULL ) { @@ -131,7 +129,7 @@ INT_PTR registerToken(WPARAM wParam, LPARAM lParam) memcpy( &tre->tr, newVr, newVr->cbSize ); tre->nameHash = hash; - if ( !_tcscmp( newVr->tszTokenString, _T("alias"))) + if ( !_tcscmp( newVr->tszTokenString, _T("alias"))) log_debugA("alias"); if ( !( newVr->flags & TRF_PARSEFUNC ) && newVr->szService != NULL ) @@ -182,7 +180,7 @@ TCHAR *parseFromRegister(ARGUMENTSINFO *ai) int callRes; TCHAR *temp, *res; TOKENREGISTEREX *thisVr, trCopy; - + if ( (ai == NULL) || (ai->argc == 0) || (ai->targv[0] == NULL)) { return NULL; } @@ -206,7 +204,7 @@ TCHAR *parseFromRegister(ARGUMENTSINFO *ai) // unicode variables calls a non-unicode plugin unsigned int j; ARGUMENTSINFO cAi; - + memcpy(&cAi, ai, sizeof(ARGUMENTSINFO)); cAi.argv = ( char** )malloc(ai->argc*sizeof(char *)); for ( j=0; j < ai->argc; j++ ) @@ -257,7 +255,7 @@ TCHAR *parseFromRegister(ARGUMENTSINFO *ai) TOKENREGISTEREX* getTokenRegister( int i ) { TOKENREGISTEREX *retVr; - + EnterCriticalSection(&csRegister); retVr = ( i >= tokens.count || i < 0 ) ? NULL : &tokens.items[i]->tr; LeaveCriticalSection( &csRegister ); diff --git a/plugins/Variables/variables.cpp b/plugins/Variables/variables.cpp index 26190fb779..acc5f90a26 100644 --- a/plugins/Variables/variables.cpp +++ b/plugins/Variables/variables.cpp @@ -534,23 +534,6 @@ static INT_PTR freeMemory(WPARAM wParam, LPARAM lParam) { return 0; } -/* - MS_VARS_GET_MMI - this code is copied from Miranda's core (miranda.c) -*/ -INT_PTR getMemoryManagerInterface(WPARAM wParam, LPARAM lParam) { - - struct MM_INTERFACE *mmi = (struct MM_INTERFACE*) lParam; - if (mmi || mmi->cbSize == sizeof(struct MM_INTERFACE)) - { - mmi->mmi_malloc = malloc; - mmi->mmi_realloc = realloc; - mmi->mmi_free = free; - return 0; - } - return 1; -} - int setParseOptions(struct ParseOptions *po) { if (po == NULL) { @@ -580,7 +563,6 @@ int LoadVarModule() { hFormatStringService = CreateServiceFunction(MS_VARS_FORMATSTRING, formatStringService); hFreeMemoryService = CreateServiceFunction(MS_VARS_FREEMEMORY, freeMemory); hRegisterVariableService = CreateServiceFunction(MS_VARS_REGISTERTOKEN, registerToken); - hGetMMIService = CreateServiceFunction(MS_VARS_GET_MMI, getMemoryManagerInterface); // help dialog hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); hUxTheme = NULL; diff --git a/plugins/W7UI/main.cpp b/plugins/W7UI/main.cpp index 31cfcc1c2e..b26124db71 100644 --- a/plugins/W7UI/main.cpp +++ b/plugins/W7UI/main.cpp @@ -29,8 +29,6 @@ int UnloadW7UI(); PLUGINLINK* pluginLink; HINSTANCE g_hInst; -struct LIST_INTERFACE li; -struct MM_INTERFACE mmi; int hLangpack; // {3625ACB8-794C-4727-88EA-76DBBAC6D200} @@ -74,8 +72,6 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK * link) if (!IsWinVer7Plus()) return 1; pluginLink = link; - mir_getLI(&li); - mir_getMMI(&mmi); mir_getLP(&pluginInfo); LoadW7UI(); diff --git a/plugins/WhenWasIt/WhenWasIt.cpp b/plugins/WhenWasIt/WhenWasIt.cpp index 92ab0662a5..a10b342289 100644 --- a/plugins/WhenWasIt/WhenWasIt.cpp +++ b/plugins/WhenWasIt/WhenWasIt.cpp @@ -25,7 +25,6 @@ HINSTANCE hInstance; HWND hBirthdaysDlg = NULL; HWND hUpcomingDlg = NULL; extern HANDLE hAddBirthdayWndsList = NULL; -struct MM_INTERFACE mmi; int hLangpack; CommonData commonData = {0}; @@ -66,7 +65,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { Log("%s", "Entering function " __FUNCTION__); pluginLink = link; - mir_getMMI(&mmi); mir_getLP(&pluginInfo); INITCOMMONCONTROLSEX icex; diff --git a/plugins/YAPP/popups2.cpp b/plugins/YAPP/popups2.cpp index c464ea02f9..d57a3ace9b 100644 --- a/plugins/YAPP/popups2.cpp +++ b/plugins/YAPP/popups2.cpp @@ -45,8 +45,6 @@ PLUGININFOEX pluginInfo={ PLUGINLINK *pluginLink; -MM_INTERFACE mmi; -LIST_INTERFACE li; extern "C" BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { @@ -232,9 +230,6 @@ HANDLE hEventPreShutdown, hEventModulesLoaded; extern "C" int POPUPS2_API Load(PLUGINLINK *link) { pluginLink = link; - - mir_getLI(&li); - mir_getMMI(&mmi); mir_getLP(&pluginInfo); InitMessagePump(); diff --git a/plugins/mir_core/mir_core_10.vcxproj b/plugins/mir_core/mir_core_10.vcxproj index 60bb2b1708..3516d84166 100644 --- a/plugins/mir_core/mir_core_10.vcxproj +++ b/plugins/mir_core/mir_core_10.vcxproj @@ -35,11 +35,12 @@ + - + diff --git a/plugins/mir_core/mir_core_10.vcxproj.filters b/plugins/mir_core/mir_core_10.vcxproj.filters index 30facd3a4c..1a051134b1 100644 --- a/plugins/mir_core/mir_core_10.vcxproj.filters +++ b/plugins/mir_core/mir_core_10.vcxproj.filters @@ -37,7 +37,10 @@ Source Files - + + Source Files + + Source Files diff --git a/plugins/mir_core/miranda.cpp b/plugins/mir_core/miranda.cpp index 1e714089d1..7f48e05bb2 100644 --- a/plugins/mir_core/miranda.cpp +++ b/plugins/mir_core/miranda.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HWND hAPCWindow = NULL; int InitPathUtils(void); -void RecalculateTime(void); +void (*RecalculateTime)(void); HANDLE hStackMutex, hThreadQueueEmpty; int hLangpack = 0; @@ -345,7 +345,8 @@ MIR_CORE_DLL(INT_PTR) UnwindThreadPop(WPARAM, LPARAM) static LRESULT CALLBACK APCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_NULL) SleepEx(0, TRUE); - if (msg == WM_TIMECHANGE) RecalculateTime(); + if (msg == WM_TIMECHANGE && RecalculateTime) + RecalculateTime(); return DefWindowProc(hwnd, msg, wParam, lParam); } @@ -370,17 +371,21 @@ static void LoadSystemModule(void) SetWindowLongPtr(hAPCWindow, GWLP_WNDPROC, (LONG_PTR)APCWndProc); hStackMutex = CreateMutex(NULL, FALSE, NULL); + #ifdef WIN64 + HMODULE mirInst = GetModuleHandleA("miranda64.exe"); + #else + HMODULE mirInst = GetModuleHandleA("miranda32.exe"); + #endif + RecalculateTime = (void (*)()) GetProcAddress(mirInst, "RecalculateTime"); + InitPathUtils(); - LoadLangPackModule(); InitialiseModularEngine(); - InitTimeZones(); } static void UnloadSystemModule(void) { DestroyModularEngine(); UnloadLangPackModule(); - UninitTimeZones(); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/mir_core/miranda.h b/plugins/mir_core/miranda.h index 3b639ac4aa..8a03e4111c 100644 --- a/plugins/mir_core/miranda.h +++ b/plugins/mir_core/miranda.h @@ -40,9 +40,6 @@ void UnloadLangPackModule(void); int InitialiseModularEngine(void); void DestroyModularEngine(void); -void InitTimeZones(void); -void UninitTimeZones(void); - int InitPathUtils(void); extern HINSTANCE hInst; diff --git a/plugins/mir_core/timezones.cpp b/plugins/mir_core/timezones.cpp deleted file mode 100644 index 24340cd3d8..0000000000 --- a/plugins/mir_core/timezones.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/* -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2010 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -implements services to handle location - based timezones, instead of -simple UTC offsets. -*/ - -#include "commonheaders.h" - -#include - -typedef DWORD (WINAPI *pfnGetDynamicTimeZoneInformation_t)(DYNAMIC_TIME_ZONE_INFORMATION *pdtzi); -static pfnGetDynamicTimeZoneInformation_t pfnGetDynamicTimeZoneInformation; - -typedef HRESULT (WINAPI *pfnSHLoadIndirectString_t)(LPCWSTR pszSource, LPWSTR pszOutBuf, UINT cchOutBuf, void **ppvReserved); -static pfnSHLoadIndirectString_t pfnSHLoadIndirectString; - -typedef LANGID (WINAPI *pfnGetUserDefaultUILanguage_t)(void); -static pfnGetUserDefaultUILanguage_t pfnGetUserDefaultUILanguage; - -typedef LANGID (WINAPI *pfnGetSystemDefaultUILanguage_t)(void); -static pfnGetSystemDefaultUILanguage_t pfnGetSystemDefaultUILanguage; - -typedef LPARAM (WINAPI *pfnSendMessageW_t)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -static pfnSendMessageW_t pfnSendMessageW; - -typedef struct _REG_TZI_FORMAT -{ - LONG Bias; - LONG StandardBias; - LONG DaylightBias; - SYSTEMTIME StandardDate; - SYSTEMTIME DaylightDate; -} REG_TZI_FORMAT; - -#define MIM_TZ_DISPLAYLEN 128 - -struct MIM_TIMEZONE -{ - unsigned hash; - int offset; - - TCHAR tszName[MIM_TZ_NAMELEN]; // windows name for the time zone - wchar_t szDisplay[MIM_TZ_DISPLAYLEN]; // more descriptive display name (that's what usually appears in dialogs) - // every hour should be sufficient. - TIME_ZONE_INFORMATION tzi; - - static int compareBias(const MIM_TIMEZONE* p1, const MIM_TIMEZONE* p2) - { return p2->tzi.Bias - p1->tzi.Bias; } -}; - -typedef struct -{ - DWORD timestamp; // last time updated - MIM_TIMEZONE myTZ; // set to my own timezone -} TZ_INT_INFO; - -static TZ_INT_INFO myInfo; -bool muiInstalled; - -static OBJLIST g_timezones(55, NumericKeySortT); -static LIST g_timezonesBias(55, MIM_TIMEZONE::compareBias); - -void FormatTime (const SYSTEMTIME *st, const TCHAR *szFormat, TCHAR *szDest, int cbDest); -void UnixTimeToFileTime(time_t ts, LPFILETIME pft); -time_t FileTimeToUnixTime(LPFILETIME pft); - -#define fnSystemTimeToTzSpecificLocalTime SystemTimeToTzSpecificLocalTime - -void GetLocalizedString(HKEY hSubKey, const TCHAR *szName, wchar_t *szBuf, DWORD cbLen) -{ - szBuf[0] = 0; - if (muiInstalled) - { - TCHAR tszTempBuf[MIM_TZ_NAMELEN], tszName[30]; - mir_sntprintf(tszName, SIZEOF(tszName), _T("MUI_%s"), szName); - DWORD dwLength = cbLen * sizeof(TCHAR); - if (ERROR_SUCCESS == RegQueryValueEx(hSubKey, tszName, NULL, NULL, (unsigned char *)tszTempBuf, &dwLength)) - { - tszTempBuf[min(dwLength / sizeof(TCHAR), cbLen - 1)] = 0; - if (pfnSHLoadIndirectString) - pfnSHLoadIndirectString(StrConvU(tszTempBuf), szBuf, cbLen, NULL); - } - } - if (szBuf[0] == 0) - { - DWORD dwLength = cbLen * sizeof(wchar_t); - - - RegQueryValueEx(hSubKey, szName, NULL, NULL, (unsigned char *)szBuf, &dwLength); - szBuf[min(dwLength / sizeof(TCHAR), cbLen - 1)] = 0; - } -} - -void RecalculateTime(void) -{ - GetTimeZoneInformation(&myInfo.myTZ.tzi); - myInfo.timestamp = time(NULL); - myInfo.myTZ.offset = INT_MIN; - - bool found = false; - DYNAMIC_TIME_ZONE_INFORMATION dtzi; - - if (pfnGetDynamicTimeZoneInformation && pfnGetDynamicTimeZoneInformation(&dtzi) != TIME_ZONE_ID_INVALID) - { - TCHAR *myTzKey = mir_u2t(dtzi.TimeZoneKeyName); - _tcscpy(myInfo.myTZ.tszName, myTzKey); - mir_free(myTzKey); - found = true; - } - - for (int i = 0; i < g_timezones.getCount(); ++i) - { - MIM_TIMEZONE &tz = g_timezones[i]; - if (tz.offset != INT_MIN) tz.offset = INT_MIN; - - if ( !found) - { - if ( !wcscmp(tz.tzi.StandardName, myInfo.myTZ.tzi.StandardName) || - !wcscmp(tz.tzi.DaylightName, myInfo.myTZ.tzi.DaylightName)) - { - _tcscpy(myInfo.myTZ.tszName, tz.tszName); - found = true; - } - } - } -} - -void InitTimeZones(void) -{ - REG_TZI_FORMAT tzi; - HKEY hKey; - - const TCHAR *tszKey = IsWinVerNT() ? - _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones") : - _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Time Zones"); - - /* - * use GetDynamicTimeZoneInformation() on Vista+ - this will return a structure with - * the registry key name, so finding our own time zone later will be MUCH easier for - * localized systems or systems with a MUI pack installed - */ - if (IsWinVerVistaPlus()) - pfnGetDynamicTimeZoneInformation = (pfnGetDynamicTimeZoneInformation_t)GetProcAddress(GetModuleHandle(_T("kernel32")), "GetDynamicTimeZoneInformation"); - - if (IsWinVer2000Plus()) - { - pfnSHLoadIndirectString = (pfnSHLoadIndirectString_t)GetProcAddress(GetModuleHandle(_T("shlwapi")), "SHLoadIndirectString"); - pfnGetSystemDefaultUILanguage = (pfnGetSystemDefaultUILanguage_t)GetProcAddress(GetModuleHandle(_T("kernel32")), "GetSystemDefaultUILanguage"); - pfnGetUserDefaultUILanguage = (pfnGetUserDefaultUILanguage_t)GetProcAddress(GetModuleHandle(_T("kernel32")), "GetUserDefaultUILanguage"); - muiInstalled = pfnSHLoadIndirectString && pfnGetSystemDefaultUILanguage() != pfnGetUserDefaultUILanguage(); - } - - pfnSendMessageW = (pfnSendMessageW_t)GetProcAddress(GetModuleHandle(_T("user32")), "SendMessageW"); - - if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, tszKey, 0, KEY_ENUMERATE_SUB_KEYS, &hKey)) - { - DWORD dwIndex = 0; - HKEY hSubKey; - TCHAR tszName[MIM_TZ_NAMELEN]; - - DWORD dwSize = SIZEOF(tszName); - while (ERROR_NO_MORE_ITEMS != RegEnumKeyEx(hKey, dwIndex++, tszName, &dwSize, NULL, NULL, 0, NULL)) - { - if (ERROR_SUCCESS == RegOpenKeyEx(hKey, tszName, 0, KEY_QUERY_VALUE, &hSubKey)) - { - dwSize = sizeof(tszName); - - DWORD dwLength = sizeof(tzi); - if (ERROR_SUCCESS != RegQueryValueEx(hSubKey, _T("TZI"), NULL, NULL, (unsigned char *)&tzi, &dwLength)) - continue; - - MIM_TIMEZONE *tz = new MIM_TIMEZONE; - - tz->tzi.Bias = tzi.Bias; - tz->tzi.StandardDate = tzi.StandardDate; - tz->tzi.StandardBias = tzi.StandardBias; - tz->tzi.DaylightDate = tzi.DaylightDate; - tz->tzi.DaylightBias = tzi.DaylightBias; - - _tcscpy(tz->tszName, tszName); - tz->hash = mir_hashstrT(tszName); - tz->offset = INT_MIN; - - GetLocalizedString(hSubKey, _T("Display"), tz->szDisplay, SIZEOF(tz->szDisplay)); - GetLocalizedString(hSubKey, _T("Std"), tz->tzi.StandardName, SIZEOF(tz->tzi.StandardName)); - GetLocalizedString(hSubKey, _T("Dlt"), tz->tzi.DaylightName, SIZEOF(tz->tzi.DaylightName)); - - g_timezones.insert(tz); - g_timezonesBias.insert(tz); - - RegCloseKey(hSubKey); - } - dwSize = SIZEOF(tszName); - } - RegCloseKey(hKey); - } - - RecalculateTime(); -} - -void UninitTimeZones(void) -{ - g_timezonesBias.destroy(); - g_timezones.destroy(); -} diff --git a/protocols/AimOscar/aim.cpp b/protocols/AimOscar/aim.cpp index e59bdbf395..655fd0e42c 100644 --- a/protocols/AimOscar/aim.cpp +++ b/protocols/AimOscar/aim.cpp @@ -22,10 +22,6 @@ along with this program. If not, see . char AIM_CAP_MIRANDA[16] = "MirandaA"; PLUGINLINK *pluginLink; -MD5_INTERFACE md5i; -MM_INTERFACE mmi; -UTF8_INTERFACE utfi; -LIST_INTERFACE li; int hLangpack; HINSTANCE hInstance; @@ -115,10 +111,6 @@ static int protoUninit(PROTO_INTERFACE* ppro) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI(&mmi); - mir_getMD5I(&md5i); - mir_getUTFI(&utfi); - mir_getLI(&li); mir_getLP(&pluginInfo); hMooduleLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); diff --git a/protocols/FacebookRM/main.cpp b/protocols/FacebookRM/main.cpp index 8725af285e..e287712d0c 100644 --- a/protocols/FacebookRM/main.cpp +++ b/protocols/FacebookRM/main.cpp @@ -24,11 +24,7 @@ along with this program. If not, see . // TODO: Make following as "globals" structure? PLUGINLINK *pluginLink; -MM_INTERFACE mmi; -LIST_INTERFACE li; CLIST_INTERFACE* pcli; -UTF8_INTERFACE utfi; -MD5_INTERFACE md5i; int hLangpack; HINSTANCE g_hInstance; @@ -127,10 +123,6 @@ static HANDLE g_hEvents[1]; extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI(&mmi); - mir_getLI(&li); - mir_getUTFI(&utfi); - mir_getMD5I(&md5i); mir_getLP(&pluginInfo); pcli = reinterpret_cast( CallService( diff --git a/protocols/Gadu-Gadu/gg.c b/protocols/Gadu-Gadu/gg.c index 6cb5abf554..778f62eeb1 100644 --- a/protocols/Gadu-Gadu/gg.c +++ b/protocols/Gadu-Gadu/gg.c @@ -43,10 +43,6 @@ static const MUUID interfaces[] = {MIID_PROTOCOL, MIID_LAST}; // Other variables HINSTANCE hInstance; PLUGINLINK *pluginLink; -struct MM_INTERFACE mmi; -struct SHA1_INTERFACE sha1i; -struct MD5_INTERFACE md5i; -struct LIST_INTERFACE li; XML_API xi; SSL_API si; CLIST_INTERFACE *pcli; @@ -572,10 +568,6 @@ int __declspec(dllexport) Load(PLUGINLINK * link) PROTOCOLDESCRIPTOR pd; pluginLink = link; - mir_getMMI(&mmi); - mir_getSHA1I(&sha1i); - mir_getMD5I(&md5i); - mir_getLI(&li); mir_getXI(&xi); mir_getLP(&pluginInfo); diff --git a/protocols/Gadu-Gadu/gg.h b/protocols/Gadu-Gadu/gg.h index 8ebfbd81a8..79abb3190e 100644 --- a/protocols/Gadu-Gadu/gg.h +++ b/protocols/Gadu-Gadu/gg.h @@ -356,7 +356,6 @@ typedef void (__cdecl GGThreadFunc)(void*, void*); extern HINSTANCE hInstance; extern PLUGINLINK *pluginLink; extern CLIST_INTERFACE *pcli; -extern struct LIST_INTERFACE li; extern list_t g_Instances; // Screen saver diff --git a/protocols/Gadu-Gadu/oauth.c b/protocols/Gadu-Gadu/oauth.c index 2c0631d655..15f9e592fe 100644 --- a/protocols/Gadu-Gadu/oauth.c +++ b/protocols/Gadu-Gadu/oauth.c @@ -204,7 +204,7 @@ void oauth_setparam(SortedList *params, const char *name, const char *value) p = mir_alloc(sizeof(OAUTHPARAMETER)); p->name = oauth_uri_escape(name); p->value = oauth_uri_escape(value); - li.List_InsertPtr(params, p); + List_InsertPtr(params, p); } void oauth_freeparams(SortedList *params) @@ -331,7 +331,7 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD if (oauth_sign_request(&oauth_parameters, httpmethod, url, consumer_secret, token_secret)) { oauth_freeparams(&oauth_parameters); - li.List_Destroy(&oauth_parameters); + List_Destroy(&oauth_parameters); return NULL; } @@ -355,7 +355,7 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD } oauth_freeparams(&oauth_parameters); - li.List_Destroy(&oauth_parameters); + List_Destroy(&oauth_parameters); return res; } diff --git a/protocols/IRCG/main.cpp b/protocols/IRCG/main.cpp index a44217abc9..b94e26d614 100644 --- a/protocols/IRCG/main.cpp +++ b/protocols/IRCG/main.cpp @@ -24,9 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. PLUGINLINK* pluginLink; HINSTANCE hInst = NULL; -UTF8_INTERFACE utfi; -MM_INTERFACE mmi; -LIST_INTERFACE li; int hLangpack; @@ -100,9 +97,6 @@ static int ircProtoUninit( CIrcProto* ppro ) extern "C" int __declspec(dllexport) Load( PLUGINLINK *link ) { pluginLink = link; - mir_getMMI( &mmi ); - mir_getUTFI( &utfi ); - mir_getLI( &li ); mir_getLP( &pluginInfo ); AddIcons(); diff --git a/protocols/IcqOscarJ/init.cpp b/protocols/IcqOscarJ/init.cpp index 2e05d249ab..db0af2db23 100644 --- a/protocols/IcqOscarJ/init.cpp +++ b/protocols/IcqOscarJ/init.cpp @@ -39,10 +39,6 @@ HINSTANCE hInst; PLUGINLINK* pluginLink; -MM_INTERFACE mmi; -UTF8_INTERFACE utfi; -MD5_INTERFACE md5i; -LIST_INTERFACE li; int hLangpack; DWORD MIRANDA_VERSION; @@ -111,7 +107,6 @@ static int OnModulesLoaded( WPARAM, LPARAM ) extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMD5I( &md5i ); mir_getLP( &pluginInfo ); // Get Miranda version diff --git a/protocols/JabberG/jabber.cpp b/protocols/JabberG/jabber.cpp index d265df4fc8..a5f21e2613 100644 --- a/protocols/JabberG/jabber.cpp +++ b/protocols/JabberG/jabber.cpp @@ -63,13 +63,8 @@ PLUGININFOEX pluginInfo = { {0x144e80a2, 0xd198, 0x428b, {0xac, 0xbe, 0x9d, 0x55, 0xda, 0xcc, 0x7f, 0xde}} // {144E80A2-D198-428b-ACBE-9D55DACC7FDE} }; -MM_INTERFACE mmi; -LIST_INTERFACE li; -UTF8_INTERFACE utfi; -MD5_INTERFACE md5i; -SHA1_INTERFACE sha1i; -XML_API xi; -TIME_API tmi; +XML_API xi; +TIME_API tmi; CLIST_INTERFACE* pcli; @@ -234,11 +229,6 @@ extern "C" int __declspec( dllexport ) Load( PLUGINLINK *link ) pluginLink = link; // set the memory, lists & utf8 managers - mir_getMMI( &mmi ); - mir_getLI( &li ); - mir_getUTFI( &utfi ); - mir_getMD5I( &md5i ); - mir_getSHA1I( &sha1i ); mir_getXI( &xi ); mir_getTMI( &tmi ); mir_getLP( &pluginInfo ); diff --git a/protocols/MRA/Mra.cpp b/protocols/MRA/Mra.cpp index 4bc6f56c28..0cf1e55d46 100644 --- a/protocols/MRA/Mra.cpp +++ b/protocols/MRA/Mra.cpp @@ -1,7 +1,6 @@ #include "Mra.h" PLUGINLINK *pluginLink; -MM_INTERFACE mmi; MRA_SETTINGS masMraSettings; int hLangpack; @@ -72,9 +71,7 @@ extern "C" MRA_API int Load(PLUGINLINK *link) PROTOCOLDESCRIPTOR pd={0}; pluginLink=link; - mir_getLP(&pluginInfoEx); - mir_getMMI(&mmi); - + mir_getLP(&pluginInfoEx); // Get module name from DLL file name if (GetModuleFileName(masMraSettings.hInstance,szBuff,MAX_FILEPATH)) @@ -105,7 +102,7 @@ extern "C" MRA_API int Load(PLUGINLINK *link) // load libs if (GetModuleFileName(NULL,szBuff,MAX_FILEPATH)) - {// + {// DWORD dwErrorCode; masMraSettings.dwMirWorkDirPathLen=GetFullPathName(szBuff,MAX_FILEPATH,masMraSettings.szMirWorkDirPath,&lpwszFileName); @@ -215,11 +212,8 @@ extern "C" MRA_API int Unload(void) masMraSettings.lpfnUncompress=NULL; } - SecureZeroMemory(pluginLink,sizeof(pluginLink)); - SecureZeroMemory(&mmi,sizeof(pluginLink)); - DebugPrintCRLFW(L"Unload - DONE"); -return(0); + return(0); } @@ -257,7 +251,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) DB_Mra_CreateResidentSetting(DBSETTING_BLOGSTATUSID); DB_Mra_CreateResidentSetting(DBSETTING_BLOGSTATUS); DB_Mra_CreateResidentSetting(DBSETTING_BLOGSTATUSMUSIC); - + // всех в offline // тк unsaved values сохраняются их нужно инициализировать for(HANDLE hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);hContact!=NULL;hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0)) {// функция сама проверяет принадлежность контакта к MRA @@ -266,7 +260,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) #endif MraAvatarsQueueInitialize(&masMraSettings.hAvatarsQueueHandle); - + VersionConversions(); MraAntiSpamLoadBadWordsW(); @@ -287,7 +281,7 @@ int OnPreShutdown(WPARAM wParam,LPARAM lParam) InterlockedExchange((volatile LONG*)&masMraSettings.dwGlobalPluginRunning,FALSE); MraSetStatus(ID_STATUS_OFFLINE,0); - + MraAvatarsQueueDestroy(masMraSettings.hAvatarsQueueHandle); masMraSettings.hAvatarsQueueHandle=NULL; diff --git a/protocols/MSN/msn.cpp b/protocols/MSN/msn.cpp index 4554de8538..16b11dedaa 100644 --- a/protocols/MSN/msn.cpp +++ b/protocols/MSN/msn.cpp @@ -25,13 +25,7 @@ along with this program. If not, see . HINSTANCE hInst; PLUGINLINK *pluginLink; int hLangpack; - -MM_INTERFACE mmi; -LIST_INTERFACE li; -UTF8_INTERFACE utfi; -MD5_INTERFACE md5i; -SHA1_INTERFACE sha1i; -TIME_API tmi; +TIME_API tmi; HANDLE hMooduleLoaded; @@ -121,12 +115,6 @@ static int msnProtoUninit(CMsnProto* ppro) extern "C" int __declspec(dllexport) Load(PLUGINLINK* link) { pluginLink = link; - - mir_getLI(&li); - mir_getMMI(&mmi); - mir_getUTFI(&utfi); - mir_getMD5I(&md5i); - mir_getSHA1I(&sha1i); mir_getTMI(&tmi); mir_getLP(&pluginInfo); diff --git a/protocols/NewsAggregator/Src/NewsAggregator.cpp b/protocols/NewsAggregator/Src/NewsAggregator.cpp index 7d33817b86..694eb46bea 100644 --- a/protocols/NewsAggregator/Src/NewsAggregator.cpp +++ b/protocols/NewsAggregator/Src/NewsAggregator.cpp @@ -22,13 +22,11 @@ Boston, MA 02111-1307, USA. HINSTANCE hInst = NULL; PLUGINLINK *pluginLink; int hLangpack; -struct MM_INTERFACE mmi; HANDLE hOptHook = NULL, hLoadHook = NULL, hOnPreShutdown = NULL, hPrebuildMenuHook = NULL, hPackUpdaterFolder = NULL; HANDLE hProtoService[7]; HWND hAddFeedDlg; HANDLE hChangeFeedDlgList = NULL; XML_API xi = {0}; -struct UTF8_INTERFACE utfi; TCHAR tszRoot[MAX_PATH] = {0}; HANDLE hUpdateMutex; #define NUM_SERVICES 6 @@ -71,10 +69,7 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; mir_getLP(&pluginInfoEx); - mir_getMMI(&mmi); - mir_getXI(&xi); - mir_getUTFI(&utfi); - + mir_getXI(&xi); if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) { hPackUpdaterFolder = FoldersRegisterCustomPathT("News Aggregator", "Avatars", MIRANDA_USERDATAT _T("\\Avatars\\")_T(DEFAULT_AVATARS_FOLDER)); diff --git a/protocols/Omegle/main.cpp b/protocols/Omegle/main.cpp index 14a5cb4426..c3413f38fe 100644 --- a/protocols/Omegle/main.cpp +++ b/protocols/Omegle/main.cpp @@ -24,10 +24,7 @@ along with this program. If not, see . // TODO: Make following as "globals" structure? PLUGINLINK *pluginLink; -MM_INTERFACE mmi; -LIST_INTERFACE li; CLIST_INTERFACE* pcli; -UTF8_INTERFACE utfi; int hLangpack; HINSTANCE g_hInstance; @@ -126,9 +123,6 @@ static HANDLE g_hEvents[1]; extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI(&mmi); - mir_getLI(&li); - mir_getUTFI(&utfi); mir_getLP(&pluginInfo); pcli = reinterpret_cast( CallService( diff --git a/protocols/Quotes/Forex.cpp b/protocols/Quotes/Forex.cpp index bd86956a2c..f7df776ee2 100644 --- a/protocols/Quotes/Forex.cpp +++ b/protocols/Quotes/Forex.cpp @@ -32,8 +32,6 @@ #include "version.h" PLUGINLINK* pluginLink = NULL; -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; int hLangpack; HANDLE g_hEventWorkThreadStop; @@ -440,8 +438,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI(&mmi); - mir_getUTFI(&utfi); mir_getLP(&Global_pluginInfo); // if ((mirandaVersion >= 0x0800) && (1 == mir_getXI(&xi))) // { diff --git a/protocols/Twitter/main.cpp b/protocols/Twitter/main.cpp index 2c3c663156..cc9ddc95c2 100644 --- a/protocols/Twitter/main.cpp +++ b/protocols/Twitter/main.cpp @@ -24,11 +24,6 @@ along with this program. If not, see . #include "m_updater.h" PLUGINLINK *pluginLink; -MD5_INTERFACE md5i; -MM_INTERFACE mmi; -UTF8_INTERFACE utfi; -LIST_INTERFACE li; - CLIST_INTERFACE* pcli; HINSTANCE g_hInstance; @@ -122,10 +117,6 @@ static HANDLE g_hEvents[1]; extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; - mir_getMMI(&mmi); - mir_getMD5I(&md5i); - mir_getUTFI(&utfi); - mir_getLI(&li); mir_getLP(&pluginInfo); pcli = reinterpret_cast( CallService( diff --git a/protocols/Weather/weather.cpp b/protocols/Weather/weather.cpp index 6fc059caa6..94d2e77881 100644 --- a/protocols/Weather/weather.cpp +++ b/protocols/Weather/weather.cpp @@ -57,8 +57,6 @@ BOOL ThreadRunning; // variable to determine if module loaded BOOL ModuleLoaded; -struct MM_INTERFACE mmi; -struct UTF8_INTERFACE utfi; PLUGINLINK *pluginLink; @@ -221,9 +219,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) DWORD lastver; pluginLink = link; - - mir_getMMI(&mmi); - mir_getUTFI(&utfi); mir_getLP(&pluginInfoEx); // initialize global variables diff --git a/protocols/YAMN/main.cpp b/protocols/YAMN/main.cpp index 7ea9386c4c..f2385036a8 100644 --- a/protocols/YAMN/main.cpp +++ b/protocols/YAMN/main.cpp @@ -37,7 +37,6 @@ PLUGINLINK *pluginLink; YAMN_VARIABLES YAMNVar; int hLangpack; -MM_INTERFACE mmi; PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -404,9 +403,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) int i, k; pluginLink = link; - mir_getLP(&pluginInfo); - mir_getMMI(&mmi); - + mir_getLP(&pluginInfo); YAMN_STATUS = ID_STATUS_OFFLINE; // we get the Miranda Root Path diff --git a/protocols/Yahoo/libyahoo2/config.h b/protocols/Yahoo/libyahoo2/config.h index c512971fa6..53ef7ca7cf 100644 --- a/protocols/Yahoo/libyahoo2/config.h +++ b/protocols/Yahoo/libyahoo2/config.h @@ -56,16 +56,4 @@ */ #include -#define md5_byte_t mir_md5_byte_t -#define md5_state_t mir_md5_state_t - -#define md5_init(A) md5i.md5_init(A) -#define md5_append(A,B,C) md5i.md5_append(A,B,C) -#define md5_finish(A,B) md5i.md5_finish(A,B) - -#define sha1_ctx mir_sha1_ctx -#define sha1_init(A) sha1i.sha1_init(A) -#define sha1_append(A,B,C) sha1i.sha1_append(A,B,C) -#define sha1_finish(A,B) sha1i.sha1_finish(A,B) - #endif diff --git a/protocols/Yahoo/libyahoo2/crypt.c b/protocols/Yahoo/libyahoo2/crypt.c index d84ecd0644..d8c50a08f6 100644 --- a/protocols/Yahoo/libyahoo2/crypt.c +++ b/protocols/Yahoo/libyahoo2/crypt.c @@ -50,9 +50,9 @@ char *yahoo_crypt(char *key, char *salt) int buflen = 0; int needed = 3 + strlen (salt) + 1 + 26 + 1; - md5_byte_t alt_result[16]; - md5_state_t ctx; - md5_state_t alt_ctx; + mir_md5_byte_t alt_result[16]; + mir_md5_state_t ctx; + mir_md5_state_t alt_ctx; int salt_len; int key_len; int cnt; @@ -74,41 +74,41 @@ char *yahoo_crypt(char *key, char *salt) key_len = (int)strlen (key); /* Prepare for the real work. */ - md5_init(&ctx); + mir_md5_init(&ctx); /* Add the key string. */ - md5_append(&ctx, (md5_byte_t *)key, (int)key_len); + mir_md5_append(&ctx, (mir_md5_byte_t *)key, (int)key_len); /* Because the SALT argument need not always have the salt prefix we add it separately. */ - md5_append(&ctx, (md5_byte_t *)md5_salt_prefix, sizeof (md5_salt_prefix) - 1); + mir_md5_append(&ctx, (mir_md5_byte_t *)md5_salt_prefix, sizeof (md5_salt_prefix) - 1); /* The last part is the salt string. This must be at most 8 characters and it ends at the first `$' character (for compatibility which existing solutions). */ - md5_append(&ctx, (md5_byte_t *)salt, (int)salt_len); + mir_md5_append(&ctx, (mir_md5_byte_t *)salt, (int)salt_len); /* Compute alternate MD5 sum with input KEY, SALT, and KEY. The final result will be added to the first context. */ - md5_init(&alt_ctx); + mir_md5_init(&alt_ctx); /* Add key. */ - md5_append(&alt_ctx, (md5_byte_t *)key, key_len); + mir_md5_append(&alt_ctx, (mir_md5_byte_t *)key, key_len); /* Add salt. */ - md5_append(&alt_ctx, (md5_byte_t *)salt, salt_len); + mir_md5_append(&alt_ctx, (mir_md5_byte_t *)salt, salt_len); /* Add key again. */ - md5_append(&alt_ctx, (md5_byte_t *)key, key_len); + mir_md5_append(&alt_ctx, (mir_md5_byte_t *)key, key_len); /* Now get result of this (16 bytes) and add it to the other context. */ - md5_finish(&alt_ctx, alt_result); + mir_md5_finish(&alt_ctx, alt_result); /* Add for any character in the key one byte of the alternate sum. */ for (cnt = key_len; cnt > 16; cnt -= 16) - md5_append(&ctx, alt_result, 16); - md5_append(&ctx, alt_result, cnt); + mir_md5_append(&ctx, alt_result, 16); + mir_md5_append(&ctx, alt_result, cnt); /* For the following code we need a NUL byte. */ alt_result[0] = '\0'; @@ -118,40 +118,40 @@ char *yahoo_crypt(char *key, char *salt) bit the first character of the key. This does not seem to be what was intended but we have to follow this to be compatible. */ for (cnt = key_len; cnt > 0; cnt >>= 1) - md5_append(&ctx, (cnt & 1) != 0 ? alt_result : (md5_byte_t *)key, 1); + mir_md5_append(&ctx, (cnt & 1) != 0 ? alt_result : (mir_md5_byte_t *)key, 1); /* Create intermediate result. */ - md5_finish(&ctx, alt_result); + mir_md5_finish(&ctx, alt_result); /* Now comes another weirdness. In fear of password crackers here comes a quite long loop which just processes the output of the previous round again. We cannot ignore this here. */ for (cnt = 0; cnt < 1000; ++cnt) { /* New context. */ - md5_init(&ctx); + mir_md5_init(&ctx); /* Add key or last result. */ if ((cnt & 1) != 0) - md5_append(&ctx, (md5_byte_t *)key, key_len); + mir_md5_append(&ctx, (mir_md5_byte_t *)key, key_len); else - md5_append(&ctx, alt_result, 16); + mir_md5_append(&ctx, alt_result, 16); /* Add salt for numbers not divisible by 3. */ if (cnt % 3 != 0) - md5_append(&ctx, (md5_byte_t *)salt, salt_len); + mir_md5_append(&ctx, (mir_md5_byte_t *)salt, salt_len); /* Add key for numbers not divisible by 7. */ if (cnt % 7 != 0) - md5_append(&ctx, (md5_byte_t *)key, key_len); + mir_md5_append(&ctx, (mir_md5_byte_t *)key, key_len); /* Add key or last result. */ if ((cnt & 1) != 0) - md5_append(&ctx, alt_result, 16); + mir_md5_append(&ctx, alt_result, 16); else - md5_append(&ctx, (md5_byte_t *)key, key_len); + mir_md5_append(&ctx, (mir_md5_byte_t *)key, key_len); /* Create intermediate result. */ - md5_finish(&ctx, alt_result); + mir_md5_finish(&ctx, alt_result); } /* Now we can construct the result string. It consists of three @@ -196,8 +196,8 @@ char *yahoo_crypt(char *key, char *salt) attaching to processes or reading core dumps cannot get any information. We do it in this way to clear correct_words[] inside the MD5 implementation as well. */ - md5_init(&ctx); - md5_finish(&ctx, alt_result); + mir_md5_init(&ctx); + mir_md5_finish(&ctx, alt_result); memset (&ctx, '\0', sizeof (ctx)); memset (&alt_ctx, '\0', sizeof (alt_ctx)); diff --git a/protocols/Yahoo/libyahoo2/libyahoo2.c b/protocols/Yahoo/libyahoo2/libyahoo2.c index 77802f4ca2..f51475a5ca 100644 --- a/protocols/Yahoo/libyahoo2/libyahoo2.c +++ b/protocols/Yahoo/libyahoo2/libyahoo2.c @@ -2393,14 +2393,14 @@ static void yahoo_process_auth_0x0f(struct yahoo_input_data *yid, const char *se struct yahoo_data *yd = yid->yd; struct yahoo_server_settings *yss; - char *crumb=NULL; - char *response = NULL; - char url[1024]; - char *c, *t; - md5_byte_t result[16]; - md5_state_t ctx; - unsigned char *magic_hash = (unsigned char*) malloc(50); /* this one is like 26 bytes? */ - int i; + char *crumb=NULL; + char *response = NULL; + char url[1024]; + char *c, *t; + mir_md5_byte_t result[16]; + mir_md5_state_t ctx; + unsigned char *magic_hash = (unsigned char*) malloc(50); /* this one is like 26 bytes? */ + int i; /** case 2: Totally Cracked... Yay.. no more crypt tables.. just need some SSL magic. @@ -2655,11 +2655,11 @@ LBL_FAILED: 278:z=xUvdFBxaEeFBfOaVlmk3RSXNDMxBjU2MjQyNjFPNTE-&a=QAE&sk=DAAWDRZBoXexNr&d=c2wBTXpRMkFUSXhOVE0xTVRZNE1qWS0BYQFRQUUBenoBeFV2ZEZCZ1dBAXRpcAFNSVlVN0Q-; path=/; domain=.yahoo.com 307:VATg29jzHSXlp_2LL7J4Fw-- */ - md5_init(&ctx); + mir_md5_init(&ctx); - md5_append(&ctx, (md5_byte_t *)crumb, strlen(crumb)); - md5_append(&ctx, (md5_byte_t *)seed, strlen(seed)); - md5_finish(&ctx, result); + mir_md5_append(&ctx, (mir_md5_byte_t *)crumb, strlen(crumb)); + mir_md5_append(&ctx, (mir_md5_byte_t *)seed, strlen(seed)); + mir_md5_finish(&ctx, result); to_y64(magic_hash, result, 16); LOG(("Y64 Hash: %s", magic_hash)); @@ -6477,18 +6477,18 @@ char *yahoo_ft7dc_send(int id, const char *buddy, YList *files) struct yahoo_packet *pkt = NULL; char ft_token[32]; // we only need 23 chars actually YList *l=files; - md5_byte_t result[16]; - md5_state_t ctx; + mir_md5_byte_t result[16]; + mir_md5_state_t ctx; if (!yid) return NULL; - md5_init(&ctx); - md5_append(&ctx, (md5_byte_t *)buddy, strlen(buddy)); + mir_md5_init(&ctx); + mir_md5_append(&ctx, (mir_md5_byte_t *)buddy, strlen(buddy)); snprintf(ft_token, 32, "%lu", time(NULL)); - md5_append(&ctx, (md5_byte_t *)ft_token, strlen(ft_token)); - md5_finish(&ctx, result); + mir_md5_append(&ctx, (mir_md5_byte_t *)ft_token, strlen(ft_token)); + mir_md5_finish(&ctx, result); to_y64((unsigned char *)ft_token, result, 16); yd = yid->yd; diff --git a/protocols/Yahoo/main.cpp b/protocols/Yahoo/main.cpp index 6f37098361..222c4d6723 100644 --- a/protocols/Yahoo/main.cpp +++ b/protocols/Yahoo/main.cpp @@ -25,10 +25,6 @@ PLUGINLINK* pluginLink; HANDLE g_hNetlibUser; -MM_INTERFACE mmi; -UTF8_INTERFACE utfi; -MD5_INTERFACE md5i; -LIST_INTERFACE li; int hLangpack; PLUGININFOEX pluginInfo={ @@ -106,16 +102,6 @@ extern "C" int __declspec(dllexport)Load(PLUGINLINK *link) /** * Grab the interface handles (through pluginLink) */ - int i = mir_getLI( &li ); - - if (i) { - MessageBox(NULL, _T("Can not retrieve the core List Interface."), _T("Yahoo Plugin Load Failed"), MB_ICONERROR | MB_OK); - return 1; - } - - mir_getMMI( &mmi ); - mir_getUTFI( &utfi ); - mir_getMD5I( &md5i ); mir_getLP( &pluginInfo ); PROTOCOLDESCRIPTOR pd = { 0 }; diff --git a/protocols/Yahoo/yahoo.h b/protocols/Yahoo/yahoo.h index ec11ecb520..552f40cc46 100644 --- a/protocols/Yahoo/yahoo.h +++ b/protocols/Yahoo/yahoo.h @@ -17,7 +17,6 @@ extern "C" { - extern struct MD5_INTERFACE md5i; extern struct tagPLUGINLINK* pluginLink; }; diff --git a/src/core/miranda.cpp b/src/core/miranda.cpp index baf786a8d3..8985d2a333 100644 --- a/src/core/miranda.cpp +++ b/src/core/miranda.cpp @@ -488,6 +488,31 @@ static INT_PTR RemoveWait(WPARAM wParam, LPARAM) return 0; } +/////////////////////////////////////////////////////////////////////////////// + +struct MM_INTERFACE +{ + size_t cbSize; + void* (*mmi_malloc) (size_t); + void* (*mmi_realloc) (void*, size_t); + void (*mmi_free) (void*); + + void* (*mmi_calloc) (size_t); + char* (*mmi_strdup) (const char *src); + wchar_t* (*mmi_wstrdup) (const wchar_t *src); + int (*mir_snprintf) (char *buffer, size_t count, const char* fmt, ...); + int (*mir_sntprintf) (TCHAR *buffer, size_t count, const TCHAR* fmt, ...); + int (*mir_vsnprintf) (char *buffer, size_t count, const char* fmt, va_list va); + int (*mir_vsntprintf) (TCHAR *buffer, size_t count, const TCHAR* fmt, va_list va); + + wchar_t* (*mir_a2u_cp) (const char* src, int codepage); + wchar_t* (*mir_a2u)(const char* src); + char* (*mir_u2a_cp)(const wchar_t* src, int codepage); + char* (*mir_u2a)(const wchar_t* src); +}; + +#define MS_SYSTEM_GET_MMI "Miranda/System/GetMMI" + INT_PTR GetMemoryManagerInterface(WPARAM, LPARAM lParam) { struct MM_INTERFACE *mmi = (struct MM_INTERFACE*) lParam; @@ -529,6 +554,30 @@ INT_PTR GetMemoryManagerInterface(WPARAM, LPARAM lParam) return 0; } +/////////////////////////////////////////////////////////////////////////////// + +struct LIST_INTERFACE +{ + size_t cbSize; + + SortedList* (*List_Create)(int, int); + void (*List_Destroy)(SortedList*); + + void* (*List_Find)(SortedList*, void*); + int (*List_GetIndex)(SortedList*, void*, int*); + int (*List_Insert)(SortedList*, void*, int); + int (*List_Remove)(SortedList*, int); + int (*List_IndexOf)(SortedList*, void*); + + int (*List_InsertPtr)(SortedList* list, void* p); + int (*List_RemovePtr)(SortedList* list, void* p); + + void (*List_Copy)(SortedList* src, SortedList* dst, size_t); + void (*List_ObjCopy)(SortedList* src, SortedList* dst, size_t); +}; + +#define MS_SYSTEM_GET_LI "Miranda/System/GetLI" + INT_PTR GetListInterface(WPARAM, LPARAM lParam) { struct LIST_INTERFACE *li = (struct LIST_INTERFACE*) lParam; @@ -539,42 +588,65 @@ INT_PTR GetListInterface(WPARAM, LPARAM lParam) li->List_ObjCopy = List_ObjCopy; li->List_InsertPtr = List_InsertPtr; li->List_RemovePtr = List_RemovePtr; - li->List_Create = List_Create; - li->List_Destroy = List_Destroy; - li->List_Find = List_Find; - li->List_GetIndex = List_GetIndex; - li->List_Insert = List_Insert; - li->List_Remove = List_Remove; - li->List_IndexOf = List_IndexOf; + li->List_Create = List_Create; + li->List_Destroy = List_Destroy; + li->List_Find = List_Find; + li->List_GetIndex = List_GetIndex; + li->List_Insert = List_Insert; + li->List_Remove = List_Remove; + li->List_IndexOf = List_IndexOf; return 0; } +/////////////////////////////////////////////////////////////////////////////// + +struct UTF8_INTERFACE +{ + size_t cbSize; + + // decodes utf8 and places the result back into the same buffer. + // if the second parameter is present, the additional wchar_t* string gets allocated, + // and filled with the decoded utf8 content without any information loss. + // this string should be freed using mir_free() + char* (*utf8_decode)(char* str, wchar_t** ucs2); + char* (*utf8_decodecp)(char* str, int codepage, wchar_t** ucs2); + + // encodes an ANSI string into a utf8 format using the current langpack code page, + // or CP_ACP, if lanpack is missing + // the resulting string should be freed using mir_free + char* (*utf8_encode)(const char* src); + char* (*utf8_encodecp)(const char* src, int codepage); + + // encodes an WCHAR string into a utf8 format + // the resulting string should be freed using mir_free + char* (*utf8_encodeW)(const wchar_t* src); + + // decodes utf8 and returns the result as wchar_t* that should be freed using mir_free() + // the input buffer remains unchanged + wchar_t* (*utf8_decodeW)(const char* str); + + // returns the predicted length of the utf-8 string + int (*utf8_lenW)(const wchar_t* src); +}; + +#define MS_SYSTEM_GET_UTFI "Miranda/System/GetUTFI" + INT_PTR GetUtfInterface(WPARAM, LPARAM lParam) { struct UTF8_INTERFACE *utfi = (struct UTF8_INTERFACE*) lParam; if (utfi == NULL) return 1; - switch(utfi->cbSize) { - case UTF8_INTERFACE_SIZEOF_V1: - case UTF8_INTERFACE_SIZEOF_V2: - case sizeof(struct UTF8_INTERFACE): - break; - - default: + if (utfi->cbSize != sizeof(UTF8_INTERFACE)) return 1; - } utfi->utf8_decode = Utf8Decode; utfi->utf8_decodecp = Utf8DecodeCP; utfi->utf8_encode = Utf8Encode; utfi->utf8_encodecp = Utf8EncodeCP; utfi->utf8_encodeW = Utf8EncodeW; - if (utfi->cbSize > UTF8_INTERFACE_SIZEOF_V1) - utfi->utf8_decodeW = Utf8DecodeW; - if (utfi->cbSize > UTF8_INTERFACE_SIZEOF_V2) - utfi->utf8_lenW = Ucs2toUtf8Len; - + utfi->utf8_decodeW = Utf8DecodeW; + utfi->utf8_lenW = Ucs2toUtf8Len; return 0; } diff --git a/src/miranda32_10.vcxproj b/src/miranda32_10.vcxproj index bcb5e08e44..09a3493e91 100644 --- a/src/miranda32_10.vcxproj +++ b/src/miranda32_10.vcxproj @@ -99,7 +99,7 @@ true false $(IntDir)$(TargetName).lib - $(SolutionDir)\lib + $(SolutionDir)\lib $(SolutionDir)\lib @@ -136,7 +136,7 @@ true false $(IntDir)$(TargetName).lib - $(SolutionDir)\lib + $(SolutionDir)\lib $(SolutionDir)\lib @@ -168,7 +168,7 @@ Windows false $(IntDir)$(TargetName).lib - $(SolutionDir)\lib + $(SolutionDir)\lib $(SolutionDir)\lib @@ -200,7 +200,7 @@ Windows false $(IntDir)$(TargetName).lib - $(SolutionDir)\lib + $(SolutionDir)\lib $(SolutionDir)\lib @@ -537,9 +537,6 @@ ..\..\core\commonheaders.h - - ..\..\core\commonheaders.h - ..\..\core\commonheaders.h diff --git a/src/miranda32_10.vcxproj.filters b/src/miranda32_10.vcxproj.filters index ce44b856ae..ee80ca5714 100644 --- a/src/miranda32_10.vcxproj.filters +++ b/src/miranda32_10.vcxproj.filters @@ -515,9 +515,6 @@ Modules\utils - - Modules\utils - Modules\utils @@ -527,9 +524,6 @@ Modules\utils - - Modules\utils - Modules\utils @@ -680,6 +674,9 @@ Modules\utils + + Modules\utils + diff --git a/src/modules/langpack/lpservices.cpp b/src/modules/langpack/lpservices.cpp index af4262783c..b346a6a277 100644 --- a/src/modules/langpack/lpservices.cpp +++ b/src/modules/langpack/lpservices.cpp @@ -90,6 +90,8 @@ INT_PTR srvReloadLangpack(WPARAM wParam, LPARAM lParam) int LoadLangPackModule(void) { + ReloadLangpack(NULL); + CreateServiceFunction(MS_LANGPACK_TRANSLATESTRING, srvTranslateString); CreateServiceFunction(MS_LANGPACK_TRANSLATEMENU, srvTranslateMenu); CreateServiceFunction(MS_LANGPACK_GETCODEPAGE, srvGetDefaultCodePage); diff --git a/src/modules/utils/md5.cpp b/src/modules/utils/md5.cpp index 94cd69bbe2..1ab0184e3e 100644 --- a/src/modules/utils/md5.cpp +++ b/src/modules/utils/md5.cpp @@ -5,7 +5,7 @@ warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any purpose, + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -55,308 +55,14 @@ #include "..\..\core\commonheaders.h" - -#define T_MASK ((mir_md5_word_t)~0) -#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) -#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) -#define T3 0x242070db -#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) -#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) -#define T6 0x4787c62a -#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) -#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) -#define T9 0x698098d8 -#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) -#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) -#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) -#define T13 0x6b901122 -#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) -#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) -#define T16 0x49b40821 -#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) -#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) -#define T19 0x265e5a51 -#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) -#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) -#define T22 0x02441453 -#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) -#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) -#define T25 0x21e1cde6 -#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) -#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) -#define T28 0x455a14ed -#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) -#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) -#define T31 0x676f02d9 -#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) -#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) -#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) -#define T35 0x6d9d6122 -#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) -#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) -#define T38 0x4bdecfa9 -#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) -#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) -#define T41 0x289b7ec6 -#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) -#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) -#define T44 0x04881d05 -#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) -#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) -#define T47 0x1fa27cf8 -#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) -#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) -#define T50 0x432aff97 -#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) -#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) -#define T53 0x655b59c3 -#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) -#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) -#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) -#define T57 0x6fa87e4f -#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) -#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) -#define T60 0x4e0811a1 -#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) -#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) -#define T63 0x2ad7d2bb -#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) - -//gfd* -static void md5_process(mir_md5_state_t *pms, const mir_md5_byte_t *data /*[64]*/) -{ - mir_md5_word_t - a = pms->abcd[0], b = pms->abcd[1], - c = pms->abcd[2], d = pms->abcd[3]; - mir_md5_word_t t; - /* Define storage for little-endian or both types of CPUs. */ - mir_md5_word_t xbuf[16]; - const mir_md5_word_t *X; - - { - /* - * Determine dynamically whether this is a big-endian or - * little-endian machine, since we can use a more efficient - * algorithm on the latter. - */ - static const int w = 1; - - if (*((const mir_md5_byte_t *)&w)) /* dynamic little-endian */ - { - /* - * On little-endian machines, we can process properly aligned - * data without copying it. - */ - if ( !((data - (const mir_md5_byte_t *)0) & 3)) { - /* data are properly aligned */ - X = (const mir_md5_word_t *)data; - } else { - /* not aligned */ - memcpy(xbuf, data, 64); - X = xbuf; - } - } - else /* dynamic big-endian */ - { - /* - * On big-endian machines, we must arrange the bytes in the - * right order. - */ - const mir_md5_byte_t *xp = data; - int i; - - X = xbuf; /* (dynamic only) */ - for (i = 0; i < 16; ++i, xp += 4) - xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); - } - } - -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) - - /* Round 1. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + F(b, c, d) + X[k] + T[i]) <<< s). */ -#define F(x, y, z) (((x) & (y)) | (~(x) & (z))) -#define SET1(a, b, c, d, k, s, Ti)\ - t = a + F(b, c, d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET1(a, b, c, d, 0, 7, T1); - SET1(d, a, b, c, 1, 12, T2); - SET1(c, d, a, b, 2, 17, T3); - SET1(b, c, d, a, 3, 22, T4); - SET1(a, b, c, d, 4, 7, T5); - SET1(d, a, b, c, 5, 12, T6); - SET1(c, d, a, b, 6, 17, T7); - SET1(b, c, d, a, 7, 22, T8); - SET1(a, b, c, d, 8, 7, T9); - SET1(d, a, b, c, 9, 12, T10); - SET1(c, d, a, b, 10, 17, T11); - SET1(b, c, d, a, 11, 22, T12); - SET1(a, b, c, d, 12, 7, T13); - SET1(d, a, b, c, 13, 12, T14); - SET1(c, d, a, b, 14, 17, T15); - SET1(b, c, d, a, 15, 22, T16); - - /* Round 2. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + G(b, c, d) + X[k] + T[i]) <<< s). */ -#define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) -#define SET2(a, b, c, d, k, s, Ti)\ - t = a + G(b, c, d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET2(a, b, c, d, 1, 5, T17); - SET2(d, a, b, c, 6, 9, T18); - SET2(c, d, a, b, 11, 14, T19); - SET2(b, c, d, a, 0, 20, T20); - SET2(a, b, c, d, 5, 5, T21); - SET2(d, a, b, c, 10, 9, T22); - SET2(c, d, a, b, 15, 14, T23); - SET2(b, c, d, a, 4, 20, T24); - SET2(a, b, c, d, 9, 5, T25); - SET2(d, a, b, c, 14, 9, T26); - SET2(c, d, a, b, 3, 14, T27); - SET2(b, c, d, a, 8, 20, T28); - SET2(a, b, c, d, 13, 5, T29); - SET2(d, a, b, c, 2, 9, T30); - SET2(c, d, a, b, 7, 14, T31); - SET2(b, c, d, a, 12, 20, T32); - - /* Round 3. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + H(b, c, d) + X[k] + T[i]) <<< s). */ -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define SET3(a, b, c, d, k, s, Ti)\ - t = a + H(b, c, d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET3(a, b, c, d, 5, 4, T33); - SET3(d, a, b, c, 8, 11, T34); - SET3(c, d, a, b, 11, 16, T35); - SET3(b, c, d, a, 14, 23, T36); - SET3(a, b, c, d, 1, 4, T37); - SET3(d, a, b, c, 4, 11, T38); - SET3(c, d, a, b, 7, 16, T39); - SET3(b, c, d, a, 10, 23, T40); - SET3(a, b, c, d, 13, 4, T41); - SET3(d, a, b, c, 0, 11, T42); - SET3(c, d, a, b, 3, 16, T43); - SET3(b, c, d, a, 6, 23, T44); - SET3(a, b, c, d, 9, 4, T45); - SET3(d, a, b, c, 12, 11, T46); - SET3(c, d, a, b, 15, 16, T47); - SET3(b, c, d, a, 2, 23, T48); - - /* Round 4. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + I(b, c, d) + X[k] + T[i]) <<< s). */ -#define I(x, y, z) ((y) ^ ((x) | ~(z))) -#define SET4(a, b, c, d, k, s, Ti)\ - t = a + I(b, c, d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET4(a, b, c, d, 0, 6, T49); - SET4(d, a, b, c, 7, 10, T50); - SET4(c, d, a, b, 14, 15, T51); - SET4(b, c, d, a, 5, 21, T52); - SET4(a, b, c, d, 12, 6, T53); - SET4(d, a, b, c, 3, 10, T54); - SET4(c, d, a, b, 10, 15, T55); - SET4(b, c, d, a, 1, 21, T56); - SET4(a, b, c, d, 8, 6, T57); - SET4(d, a, b, c, 15, 10, T58); - SET4(c, d, a, b, 6, 15, T59); - SET4(b, c, d, a, 13, 21, T60); - SET4(a, b, c, d, 4, 6, T61); - SET4(d, a, b, c, 11, 10, T62); - SET4(c, d, a, b, 2, 15, T63); - SET4(b, c, d, a, 9, 21, T64); - - /* Then perform the following additions. (That is increment each - of the four registers by the value it had before this block - was started.) */ - pms->abcd[0] += a; - pms->abcd[1] += b; - pms->abcd[2] += c; - pms->abcd[3] += d; -} - -void md5_init(mir_md5_state_t *pms) +struct MD5_INTERFACE { - pms->count[0] = pms->count[1] = 0; - pms->abcd[0] = 0x67452301; - pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476; - pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301; - pms->abcd[3] = 0x10325476; -} - -void md5_append(mir_md5_state_t *pms, const mir_md5_byte_t *data, int nbytes) -{ - const mir_md5_byte_t *p = data; - int left = nbytes; - int offset = (pms->count[0] >> 3) & 63; - mir_md5_word_t nbits = (mir_md5_word_t)(nbytes << 3); - - if (nbytes <= 0) - return; - - /* Update the message length. */ - pms->count[1] += nbytes >> 29; - pms->count[0] += nbits; - if (pms->count[0] < nbits) - pms->count[1]++; - - /* Process an initial partial block. */ - if (offset) { - int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); - - memcpy(pms->buf + offset, p, copy); - if (offset + copy < 64) - return; - p += copy; - left -= copy; - md5_process(pms, pms->buf); - } - - /* Process full blocks. */ - for (; left >= 64; p += 64, left -= 64) - md5_process(pms, p); - - /* Process a final partial block. */ - if (left) - memcpy(pms->buf, p, left); -} - -void md5_finish(mir_md5_state_t *pms, mir_md5_byte_t digest[16]) -{ - static const mir_md5_byte_t pad[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - mir_md5_byte_t data[8]; - int i; - - /* Save the length before padding. */ - for (i = 0; i < 8; ++i) - data[i] = (mir_md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); - /* Pad to 56 bytes mod 64. */ - md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); - /* Append the length. */ - md5_append(pms, data, 8); - for (i = 0; i < 16; ++i) - digest[i] = (mir_md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); -} - -void md5_hash_string(const mir_md5_byte_t *data, int len, mir_md5_byte_t digest[16]) -{ - mir_md5_state_t state; - md5_init(&state); - md5_append(&state, data, len); - md5_finish(&state, digest); -} + int cbSize; + void (*md5_init) (mir_md5_state_t *pms); + void (*md5_append) (mir_md5_state_t *pms, const mir_md5_byte_t *data, int nbytes); + void (*md5_finish) (mir_md5_state_t *pms, mir_md5_byte_t digest[16]); + void (*md5_hash) (const mir_md5_byte_t *data, int len, mir_md5_byte_t digest[16]); +}; INT_PTR GetMD5Interface(WPARAM, LPARAM lParam) { @@ -366,9 +72,9 @@ INT_PTR GetMD5Interface(WPARAM, LPARAM lParam) if (md5i->cbSize != sizeof(struct MD5_INTERFACE)) return 1; - md5i->md5_init = md5_init; - md5i->md5_append = md5_append; - md5i->md5_finish = md5_finish; - md5i->md5_hash = md5_hash_string; + md5i->md5_init = mir_md5_init; + md5i->md5_append = mir_md5_append; + md5i->md5_finish = mir_md5_finish; + md5i->md5_hash = mir_md5_hash; return 0; } diff --git a/src/modules/utils/sha1.cpp b/src/modules/utils/sha1.cpp deleted file mode 100644 index 2fede54718..0000000000 --- a/src/modules/utils/sha1.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is SHA 180-1 Reference Implementation (Compact version). - * - * The Initial Developer of the Original Code is - * Paul Kocher of Cryptography Research. - * Portions created by the Initial Developer are Copyright (C) 1995-9 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "..\..\core\commonheaders.h" - -static void shaHashBlock(mir_sha1_ctx *ctx); - -void shaInit(mir_sha1_ctx *ctx) { - int i; - - ctx->lenW = 0; - ctx->sizeHi = ctx->sizeLo = 0; - - /* Initialize H with the magic constants (see FIPS180 for constants) - */ - ctx->H[0] = 0x67452301L; - ctx->H[1] = 0xefcdab89L; - ctx->H[2] = 0x98badcfeL; - ctx->H[3] = 0x10325476L; - ctx->H[4] = 0xc3d2e1f0L; - - for (i = 0; i < 80; i++) - ctx->W[i] = 0; -} - - -void shaUpdate(mir_sha1_ctx *ctx, mir_sha1_byte_t *dataIn, int len) { - int i; - - /* Read the data into W and process blocks as they get full - */ - for (i = 0; i < len; i++) { - ctx->W[ctx->lenW / 4] <<= 8; - ctx->W[ctx->lenW / 4] |= (unsigned long)dataIn[i]; - if ((++ctx->lenW) % 64 == 0) { - shaHashBlock(ctx); - ctx->lenW = 0; - } - ctx->sizeLo += 8; - ctx->sizeHi += (ctx->sizeLo < 8); - } -} - - -void shaFinal(mir_sha1_ctx *ctx, mir_sha1_byte_t hashout[20]) { - unsigned char pad0x80 = 0x80; - unsigned char pad0x00 = 0x00; - unsigned char padlen[8]; - int i; - - /* Pad with a binary 1 (e.g. 0x80), then zeroes, then length - */ - padlen[0] = (unsigned char)((ctx->sizeHi >> 24) & 255); - padlen[1] = (unsigned char)((ctx->sizeHi >> 16) & 255); - padlen[2] = (unsigned char)((ctx->sizeHi >> 8) & 255); - padlen[3] = (unsigned char)((ctx->sizeHi >> 0) & 255); - padlen[4] = (unsigned char)((ctx->sizeLo >> 24) & 255); - padlen[5] = (unsigned char)((ctx->sizeLo >> 16) & 255); - padlen[6] = (unsigned char)((ctx->sizeLo >> 8) & 255); - padlen[7] = (unsigned char)((ctx->sizeLo >> 0) & 255); - shaUpdate(ctx, &pad0x80, 1); - while (ctx->lenW != 56) - shaUpdate(ctx, &pad0x00, 1); - shaUpdate(ctx, padlen, 8); - - /* Output hash - */ - for (i = 0; i < 20; i++) { - hashout[i] = (unsigned char)(ctx->H[i / 4] >> 24); - ctx->H[i / 4] <<= 8; - } - - /* - * Re-initialize the context (also zeroizes contents) - */ - shaInit(ctx); -} - - -void shaBlock(mir_sha1_byte_t *dataIn, int len, mir_sha1_byte_t hashout[20]) { - mir_sha1_ctx ctx; - - shaInit(&ctx); - shaUpdate(&ctx, dataIn, len); - shaFinal(&ctx, hashout); -} - - -#define SHA_ROTL(X, n) (((X) << (n)) | ((X) >> (32-(n)))) - -static void shaHashBlock(mir_sha1_ctx *ctx) { - int t; - unsigned long A, B, C, D, E, TEMP; - - for (t = 16; t <= 79; t++) - ctx->W[t] = - SHA_ROTL(ctx->W[t-3] ^ ctx->W[t-8] ^ ctx->W[t-14] ^ ctx->W[t-16], 1); - - A = ctx->H[0]; - B = ctx->H[1]; - C = ctx->H[2]; - D = ctx->H[3]; - E = ctx->H[4]; - - for (t = 0; t <= 19; t++) { - TEMP = SHA_ROTL(A, 5) + (((C^D)&B)^D) + E + ctx->W[t] + 0x5a827999L; - E = D; D = C; C = SHA_ROTL(B, 30); B = A; A = TEMP; - } - for (t = 20; t <= 39; t++) { - TEMP = SHA_ROTL(A, 5) + (B^C^D) + E + ctx->W[t] + 0x6ed9eba1L; - E = D; D = C; C = SHA_ROTL(B, 30); B = A; A = TEMP; - } - for (t = 40; t <= 59; t++) { - TEMP = SHA_ROTL(A, 5) + ((B&C)|(D&(B|C))) + E + ctx->W[t] + 0x8f1bbcdcL; - E = D; D = C; C = SHA_ROTL(B, 30); B = A; A = TEMP; - } - for (t = 60; t <= 79; t++) { - TEMP = SHA_ROTL(A, 5) + (B^C^D) + E + ctx->W[t] + 0xca62c1d6L; - E = D; D = C; C = SHA_ROTL(B, 30); B = A; A = TEMP; - } - - ctx->H[0] += A; - ctx->H[1] += B; - ctx->H[2] += C; - ctx->H[3] += D; - ctx->H[4] += E; -} - -INT_PTR GetSHA1Interface(WPARAM, LPARAM lParam) -{ - struct SHA1_INTERFACE *sha1i = (struct SHA1_INTERFACE*) lParam; - if (sha1i == NULL) - return 1; - if (sha1i->cbSize != sizeof(struct SHA1_INTERFACE)) - return 1; - - sha1i->sha1_init = shaInit; - sha1i->sha1_append = shaUpdate; - sha1i->sha1_finish = shaFinal; - sha1i->sha1_hash = shaBlock; - return 0; -} diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp index d90a303e49..bf83dfeb75 100644 --- a/src/modules/utils/timezones.cpp +++ b/src/modules/utils/timezones.cpp @@ -520,7 +520,7 @@ void GetLocalizedString(HKEY hSubKey, const TCHAR *szName, wchar_t *szBuf, DWORD } } -void RecalculateTime(void) +extern "C" __declspec(dllexport) void RecalculateTime(void) { GetTimeZoneInformation(&myInfo.myTZ.tzi); myInfo.timestamp = time(NULL); diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp index 964e9a920f..3ed6446003 100644 --- a/src/modules/utils/utils.cpp +++ b/src/modules/utils/utils.cpp @@ -22,6 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "..\..\core\commonheaders.h" +#define MS_SYSTEM_GET_MD5I "Miranda/System/GetMD5I" + INT_PTR ResizeDialog(WPARAM wParam, LPARAM lParam); int InitOpenUrl(void); int InitWindowList(void); @@ -475,7 +477,6 @@ int LoadUtilsModule(void) CreateServiceFunction(MS_UTILS_GETRANDOM, GenerateRandom); CreateServiceFunction(MS_SYSTEM_RESTART, RestartMiranda); CreateServiceFunction(MS_SYSTEM_GET_MD5I, GetMD5Interface); - CreateServiceFunction(MS_SYSTEM_GET_SHA1I, GetSHA1Interface); InitOpenUrl(); InitWindowList(); InitHyperlink(); -- cgit v1.2.3