From 9b3b48266470ccda4e270c6a81e91b1319b4ca22 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Fri, 24 Apr 2015 23:40:44 +0000 Subject: AVS - common project git-svn-id: http://svn.miranda-ng.org/main/trunk@13122 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AVS/src/acc.cpp | 2 +- plugins/AVS/src/cache.cpp | 2 +- plugins/AVS/src/commonheaders.h | 165 ---------------------------------------- plugins/AVS/src/image_utils.cpp | 2 +- plugins/AVS/src/main.cpp | 2 +- plugins/AVS/src/options.cpp | 2 +- plugins/AVS/src/poll.cpp | 2 +- plugins/AVS/src/services.cpp | 2 +- plugins/AVS/src/stdafx.cpp | 18 ----- plugins/AVS/src/stdafx.cxx | 18 +++++ plugins/AVS/src/stdafx.h | 165 ++++++++++++++++++++++++++++++++++++++++ plugins/AVS/src/utils.cpp | 2 +- 12 files changed, 191 insertions(+), 191 deletions(-) delete mode 100644 plugins/AVS/src/commonheaders.h delete mode 100644 plugins/AVS/src/stdafx.cpp create mode 100644 plugins/AVS/src/stdafx.cxx create mode 100644 plugins/AVS/src/stdafx.h (limited to 'plugins/AVS/src') diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index 272f55cc96..75ba7bdbf9 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -22,7 +22,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "commonheaders.h" +#include "stdafx.h" #define DM_AVATARCHANGED (WM_USER + 20) #define DM_MYAVATARCHANGED (WM_USER + 21) diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index a81ca58e99..87c6c4e7ca 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -17,7 +17,7 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "commonheaders.h" +#include "stdafx.h" CacheNode::CacheNode() { diff --git a/plugins/AVS/src/commonheaders.h b/plugins/AVS/src/commonheaders.h deleted file mode 100644 index 7027783b64..0000000000 --- a/plugins/AVS/src/commonheaders.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org) -Copyright (c) 2000-04 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. -*/ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "resource.h" -#include "version.h" -#include "image_utils.h" -#include "poll.h" -#include "acc.h" - -#ifndef SHVIEW_THUMBNAIL -#define SHVIEW_THUMBNAIL 0x702D -#endif - -/* most free()'s are invalid when the code is executed from a dll, so this changes - all the bad free()'s to good ones, however it's still incorrect code. The reasons for not - changing them include: - - * db_unset has a CallService() lookup - * free() is executed in some large loops to do with clist creation of group data - * easy search and replace - -*/ - -struct CacheNode : public avatarCacheEntry, public MZeroedObject -{ - CacheNode(); - ~CacheNode(); - - BOOL loaded; - DWORD dwFlags; - int pa_format; - - void wipeInfo(); -}; - -// The same fields as avatarCacheEntry + proto name -struct protoPicCacheEntry : public avatarCacheEntry, public MZeroedObject -{ - protoPicCacheEntry() { memset(this, 0, sizeof(*this)); }; - ~protoPicCacheEntry(); - - void clear(); - - char* szProtoname; - TCHAR* tszAccName; -}; - -extern OBJLIST g_ProtoPictures, g_MyAvatars; - -struct SetMyAvatarHookData -{ - char *protocol; - BOOL square; - BOOL grow; - - BOOL thumbnail; -}; - -extern FI_INTERFACE *fei; - -#define GAIR_FAILED 1000 - -#define AVS_IGNORENOTIFY 0x1000 - -#define AVS_DEFAULT "Global avatar" - -void mir_sleep(int time); -extern bool g_shutDown; -extern TCHAR g_szDataPath[]; // user datae path (read at startup only) -extern BOOL g_AvatarHistoryAvail; -extern HWND hwndSetMyAvatar; - -extern HINSTANCE g_hInst; - -extern HANDLE hMyAvatarsFolder; -extern HANDLE hGlobalAvatarFolder; -extern HANDLE hLoaderEvent, hShutdownEvent; -extern HANDLE hEventChanged, hEventContactAvatarChanged, hMyAvatarChanged; - -int GetFileHash(TCHAR* filename); -DWORD GetFileSize(TCHAR *szFilename); -void MakePathRelative(MCONTACT hContact); -void MakePathRelative(MCONTACT hContact, TCHAR *dest); -void MyPathToAbsolute(const TCHAR *ptszPath, TCHAR *ptszDest); - -HBITMAP LoadPNG(struct avatarCacheEntry *ace, char *szFilename); - -void UnloadCache(void); -int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto); -void DeleteAvatarFromCache(MCONTACT hContact, bool bForever); -void PicLoader(LPVOID param); - -void InternalDrawAvatar(AVATARDRAWREQUEST *r, HBITMAP hbm, LONG bmWidth, LONG bmHeight, DWORD dwFlags); - -int ChangeAvatar(MCONTACT hContact, bool fLoad, bool fNotifyHist = false, int pa_format = 0); -void DeleteGlobalUserAvatar(); -int FetchAvatarFor(MCONTACT hContact, char *szProto = NULL); -CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny = false); -void PushAvatarRequest(CacheNode *cc); -int SetAvatarAttribute(MCONTACT hContact, DWORD attrib, int mode); -void SetIgnoreNotify(char *protocol, BOOL ignore); - -INT_PTR DrawAvatarPicture(WPARAM wParam, LPARAM lParam); -INT_PTR GetAvatarBitmap(WPARAM wParam, LPARAM lParam); -INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam); -INT_PTR ProtectAvatar(WPARAM wParam, LPARAM lParam); -INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM lParam); - -MCONTACT GetContactThatHaveTheAvatar(MCONTACT hContact, int locked = -1); - -void ProcessAvatarInfo(MCONTACT hContact, int type, PROTO_AVATAR_INFORMATIONT *pai, const char *szProto); - -int Proto_GetDelayAfterFail(const char *proto); -BOOL Proto_NeedDelaysForAvatars(const char *proto); -BOOL Proto_IsAvatarsEnabled(const char *proto); -BOOL Proto_IsAvatarFormatSupported(const char *proto, int format); -int Proto_AvatarImageProportion(const char *proto); -void Proto_GetAvatarMaxSize(const char *proto, int *width, int *height); -int Proto_GetAvatarMaxFileSize(const char *proto); - -protoPicCacheEntry* GetProtoDefaultAvatar(MCONTACT hContact); diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp index 520e077254..1f251954ed 100644 --- a/plugins/AVS/src/image_utils.cpp +++ b/plugins/AVS/src/image_utils.cpp @@ -1,4 +1,4 @@ -#include "commonheaders.h" +#include "stdafx.h" #include "image_utils.h" #define GET_PIXEL(__P__, __X__, __Y__) ( __P__ + width * 4 * (__Y__) + 4 * (__X__)) diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 426c1dd8d2..1c33df43ae 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -22,7 +22,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "commonheaders.h" +#include "stdafx.h" CLIST_INTERFACE *pcli; diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 36a6af0d05..19f2068aaa 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -22,7 +22,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "commonheaders.h" +#include "stdafx.h" #define DM_SETAVATARNAME (WM_USER + 10) #define DM_REALODAVATAR (WM_USER + 11) diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp index 45ed5067b7..4b4c5511e3 100644 --- a/plugins/AVS/src/poll.cpp +++ b/plugins/AVS/src/poll.cpp @@ -17,7 +17,7 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "commonheaders.h" +#include "stdafx.h" /* It has 1 queue: diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index 3072055a6d..2760420853 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -22,7 +22,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "commonheaders.h" +#include "stdafx.h" ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/AVS/src/stdafx.cpp b/plugins/AVS/src/stdafx.cpp deleted file mode 100644 index 048b14e9d2..0000000000 --- a/plugins/AVS/src/stdafx.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org) - -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 version 2 -of the License. - -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, see . -*/ - -#include "commonheaders.h" \ No newline at end of file diff --git a/plugins/AVS/src/stdafx.cxx b/plugins/AVS/src/stdafx.cxx new file mode 100644 index 0000000000..6fb37564b7 --- /dev/null +++ b/plugins/AVS/src/stdafx.cxx @@ -0,0 +1,18 @@ +/* +Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org) + +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 version 2 +of the License. + +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, see . +*/ + +#include "stdafx.h" \ No newline at end of file diff --git a/plugins/AVS/src/stdafx.h b/plugins/AVS/src/stdafx.h new file mode 100644 index 0000000000..7027783b64 --- /dev/null +++ b/plugins/AVS/src/stdafx.h @@ -0,0 +1,165 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org) +Copyright (c) 2000-04 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. +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "resource.h" +#include "version.h" +#include "image_utils.h" +#include "poll.h" +#include "acc.h" + +#ifndef SHVIEW_THUMBNAIL +#define SHVIEW_THUMBNAIL 0x702D +#endif + +/* most free()'s are invalid when the code is executed from a dll, so this changes + all the bad free()'s to good ones, however it's still incorrect code. The reasons for not + changing them include: + + * db_unset has a CallService() lookup + * free() is executed in some large loops to do with clist creation of group data + * easy search and replace + +*/ + +struct CacheNode : public avatarCacheEntry, public MZeroedObject +{ + CacheNode(); + ~CacheNode(); + + BOOL loaded; + DWORD dwFlags; + int pa_format; + + void wipeInfo(); +}; + +// The same fields as avatarCacheEntry + proto name +struct protoPicCacheEntry : public avatarCacheEntry, public MZeroedObject +{ + protoPicCacheEntry() { memset(this, 0, sizeof(*this)); }; + ~protoPicCacheEntry(); + + void clear(); + + char* szProtoname; + TCHAR* tszAccName; +}; + +extern OBJLIST g_ProtoPictures, g_MyAvatars; + +struct SetMyAvatarHookData +{ + char *protocol; + BOOL square; + BOOL grow; + + BOOL thumbnail; +}; + +extern FI_INTERFACE *fei; + +#define GAIR_FAILED 1000 + +#define AVS_IGNORENOTIFY 0x1000 + +#define AVS_DEFAULT "Global avatar" + +void mir_sleep(int time); +extern bool g_shutDown; +extern TCHAR g_szDataPath[]; // user datae path (read at startup only) +extern BOOL g_AvatarHistoryAvail; +extern HWND hwndSetMyAvatar; + +extern HINSTANCE g_hInst; + +extern HANDLE hMyAvatarsFolder; +extern HANDLE hGlobalAvatarFolder; +extern HANDLE hLoaderEvent, hShutdownEvent; +extern HANDLE hEventChanged, hEventContactAvatarChanged, hMyAvatarChanged; + +int GetFileHash(TCHAR* filename); +DWORD GetFileSize(TCHAR *szFilename); +void MakePathRelative(MCONTACT hContact); +void MakePathRelative(MCONTACT hContact, TCHAR *dest); +void MyPathToAbsolute(const TCHAR *ptszPath, TCHAR *ptszDest); + +HBITMAP LoadPNG(struct avatarCacheEntry *ace, char *szFilename); + +void UnloadCache(void); +int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto); +void DeleteAvatarFromCache(MCONTACT hContact, bool bForever); +void PicLoader(LPVOID param); + +void InternalDrawAvatar(AVATARDRAWREQUEST *r, HBITMAP hbm, LONG bmWidth, LONG bmHeight, DWORD dwFlags); + +int ChangeAvatar(MCONTACT hContact, bool fLoad, bool fNotifyHist = false, int pa_format = 0); +void DeleteGlobalUserAvatar(); +int FetchAvatarFor(MCONTACT hContact, char *szProto = NULL); +CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny = false); +void PushAvatarRequest(CacheNode *cc); +int SetAvatarAttribute(MCONTACT hContact, DWORD attrib, int mode); +void SetIgnoreNotify(char *protocol, BOOL ignore); + +INT_PTR DrawAvatarPicture(WPARAM wParam, LPARAM lParam); +INT_PTR GetAvatarBitmap(WPARAM wParam, LPARAM lParam); +INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam); +INT_PTR ProtectAvatar(WPARAM wParam, LPARAM lParam); +INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM lParam); + +MCONTACT GetContactThatHaveTheAvatar(MCONTACT hContact, int locked = -1); + +void ProcessAvatarInfo(MCONTACT hContact, int type, PROTO_AVATAR_INFORMATIONT *pai, const char *szProto); + +int Proto_GetDelayAfterFail(const char *proto); +BOOL Proto_NeedDelaysForAvatars(const char *proto); +BOOL Proto_IsAvatarsEnabled(const char *proto); +BOOL Proto_IsAvatarFormatSupported(const char *proto, int format); +int Proto_AvatarImageProportion(const char *proto); +void Proto_GetAvatarMaxSize(const char *proto, int *width, int *height); +int Proto_GetAvatarMaxFileSize(const char *proto); + +protoPicCacheEntry* GetProtoDefaultAvatar(MCONTACT hContact); diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index c0a90ee325..70d0349948 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -17,7 +17,7 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "commonheaders.h" +#include "stdafx.h" void mir_sleep(int time) { -- cgit v1.2.3