From 1fb0cd07fba1e8d6f9ac2ebe3b4f2e1c60acb81b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Feb 2014 21:51:46 +0000 Subject: - metacontacts are always present; - added META_PROTO constant for mc module name; - MS_MC_GETPROTOCOLNAME removed, because it always returns META_PROTO git-svn-id: http://svn.miranda-ng.org/main/trunk@8319 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_metacontacts.inc | 7 +- include/m_metacontacts.h | 8 +- plugins/AVS/src/cache.cpp | 10 +- plugins/AVS/src/commonheaders.h | 3 +- plugins/AVS/src/main.cpp | 13 +-- plugins/AVS/src/poll.cpp | 5 +- plugins/AVS/src/utils.cpp | 4 +- plugins/AvatarHistory/src/AvatarHistory.cpp | 7 +- plugins/BasicHistory/src/BasicHistory.cpp | 3 - .../ClientChangeNotify/src/ClientChangeNotify.cpp | 2 +- .../Clist_modern/src/hdr/modern_commonheaders.h | 3 - plugins/Clist_modern/src/modern_cachefuncs.cpp | 2 +- plugins/Clist_modern/src/modern_clc.cpp | 118 ++++++++++----------- plugins/Clist_modern/src/modern_clcitems.cpp | 6 +- plugins/Clist_modern/src/modern_clcutils.cpp | 9 +- plugins/Clist_modern/src/modern_clistmod.cpp | 2 +- plugins/Clist_modern/src/modern_clistsettings.cpp | 4 +- plugins/Clist_modern/src/modern_clui.cpp | 3 - plugins/Clist_nicer/src/Include/clc.h | 2 - plugins/Clist_nicer/src/clc.cpp | 16 ++- plugins/Clist_nicer/src/clcitems.cpp | 6 +- plugins/Clist_nicer/src/clistmod.cpp | 2 +- plugins/Clist_nicer/src/init.cpp | 7 +- plugins/KeyboardNotify/src/main.cpp | 24 ++--- plugins/ListeningTo/src/listeningto.cpp | 4 - plugins/MirOTR/MirOTR/src/dbfilter.cpp | 2 +- plugins/MirOTR/MirOTR/src/dllmain.cpp | 8 +- plugins/MirOTR/MirOTR/src/options.cpp | 4 +- plugins/MirOTR/MirOTR/src/options.h | 2 - plugins/MirOTR/MirOTR/src/svcs_menu.cpp | 2 +- plugins/MirOTR/MirOTR/src/svcs_proto.cpp | 8 +- plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 2 +- plugins/NewXstatusNotify/src/main.cpp | 6 +- plugins/Popup/src/config.cpp | 1 - plugins/Popup/src/config.h | 2 - plugins/Popup/src/main.cpp | 5 - plugins/Popup/src/popup_wnd2.cpp | 6 +- plugins/QuickContacts/src/commons.h | 2 - plugins/QuickContacts/src/options.cpp | 63 ++++------- plugins/QuickContacts/src/quickcontacts.cpp | 37 ++----- plugins/Scriver/src/msgdialog.cpp | 4 +- plugins/SmileyAdd/src/general.cpp | 3 +- plugins/SmileyAdd/src/general.h | 1 - plugins/SmileyAdd/src/main.cpp | 7 -- plugins/SpellChecker/src/utils.cpp | 18 ++-- plugins/TabSRMM/src/contactcache.cpp | 6 +- plugins/TabSRMM/src/container.cpp | 6 +- plugins/TabSRMM/src/globals.cpp | 26 ++--- plugins/TabSRMM/src/globals.h | 3 +- plugins/TabSRMM/src/mim.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TipperYM/src/common.h | 1 - plugins/TipperYM/src/mir_smileys.cpp | 2 +- plugins/TipperYM/src/popwin.cpp | 2 +- plugins/TipperYM/src/subst.cpp | 5 +- plugins/TipperYM/src/tipper.cpp | 7 -- plugins/UserInfoEx/src/commonheaders.h | 2 - plugins/UserInfoEx/src/dlg_propsheet.cpp | 5 - .../src/ex_import/classExImContactXML.cpp | 6 +- .../UserInfoEx/src/ex_import/dlg_ExImModules.cpp | 7 +- plugins/UserInfoEx/src/init.cpp | 7 +- plugins/UserInfoEx/src/mir_db.cpp | 7 +- plugins/UserInfoEx/src/psp_options.cpp | 1 - plugins/Utils.pas/mirutils.pas | 4 +- plugins/Variables/src/parse_metacontacts.cpp | 8 +- protocols/Gadu-Gadu/src/groupchat.cpp | 5 +- src/modules/metacontacts/meta_api.cpp | 11 +- src/modules/metacontacts/meta_services.cpp | 1 - src/modules/metacontacts/metacontacts.h | 1 - 69 files changed, 199 insertions(+), 381 deletions(-) diff --git a/include/delphi/m_metacontacts.inc b/include/delphi/m_metacontacts.inc index c25dfeadc2..27912d1e4f 100644 --- a/include/delphi/m_metacontacts.inc +++ b/include/delphi/m_metacontacts.inc @@ -120,10 +120,6 @@ const lParam=0 } ME_MC_UNFORCESEND = 'MetaContacts/UnforceSend'; - { method to get protocol name - used to be sure you're dealing with a "real" metacontacts plugin :) - wParam=lParam=0 } - MS_MC_GETPROTOCOLNAME = 'MetaContacts/GetProtoName'; - { wParam=(HANDLE)hContact lParam=0 convert a given contact into a metacontact @@ -153,6 +149,9 @@ const } MS_MC_DISABLEHIDDENGROUP = 'MetaContacts/DisableHiddenGroup'; +const + META_PROTO = 'MetaContacts'; + { returns true if a contact is a metacontact or false otherwise } function db_mc_isMeta(hContact:MCONTACT):Integer; stdcall; diff --git a/include/m_metacontacts.h b/include/m_metacontacts.h index 02d0fece6f..e652d09871 100644 --- a/include/m_metacontacts.h +++ b/include/m_metacontacts.h @@ -26,6 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include +// standard module for all mc-related information +#define META_PROTO "MetaContacts" + //gets the handle for the default contact //wParam=(HANDLE)hMetaContact //lParam=0 @@ -124,11 +127,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // lParam=0 #define ME_MC_UNFORCESEND "MetaContacts/UnforceSend" -// method to get protocol name - used to be sure you're dealing with a "real" metacontacts plugin :) -// wParam=lParam=0 -#define MS_MC_GETPROTOCOLNAME "MetaContacts/GetProtoName" - - // added 0.9.5.0 (22/3/05) // wParam=(HANDLE)hContact // lParam=0 diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index 37c42cb00d..93aa9abe1d 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -126,8 +126,7 @@ CacheNode *FindAvatarInCache(MCONTACT hContact, BOOL add, BOOL findAny) } foundNode->ace.hContact = hContact; - if (g_MetaAvail) - foundNode->dwFlags |= (db_mc_isSub(hContact) ? MC_ISSUBCONTACT : 0); + foundNode->dwFlags |= (db_mc_isSub(hContact) ? MC_ISSUBCONTACT : 0); foundNode->loaded = FALSE; foundNode->mustLoad = 1; // pic loader will watch this and load images SetEvent(hLoaderEvent); // wake him up @@ -153,8 +152,8 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node = NULL, AVATARCACHEENTRY NotifyEventHooks(hEventChanged, hContact, (LPARAM)ace); - if (g_MetaAvail && (node->dwFlags & MC_ISSUBCONTACT) && db_get_b(NULL, g_szMetaName, "Enabled", 0)) { - MCONTACT hMasterContact = (MCONTACT)db_get_dw(hContact, g_szMetaName, "Handle", 0); + if ((node->dwFlags & MC_ISSUBCONTACT) && db_get_b(NULL, META_PROTO, "Enabled", 0)) { + MCONTACT hMasterContact = (MCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0); if (hMasterContact && (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMasterContact, 0) == hContact && !db_get_b(hMasterContact, "ContactPhoto", "Locked", 0)) NotifyEventHooks(hEventChanged, (WPARAM)hMasterContact, (LPARAM)ace); @@ -209,8 +208,7 @@ void DeleteAvatarFromCache(MCONTACT hContact, BOOL forever) CacheNode *node = FindAvatarInCache(hContact, FALSE); if (node == NULL) { struct CacheNode temp_node = {0}; - if (g_MetaAvail) - temp_node.dwFlags |= (db_mc_isSub(hContact) ? MC_ISSUBCONTACT : 0); + temp_node.dwFlags |= (db_mc_isSub(hContact) ? MC_ISSUBCONTACT : 0); NotifyMetaAware(hContact, &temp_node, (AVATARCACHEENTRY *)GetProtoDefaultAvatar(hContact)); return; } diff --git a/plugins/AVS/src/commonheaders.h b/plugins/AVS/src/commonheaders.h index 6507b2ecd9..87f8044d8d 100644 --- a/plugins/AVS/src/commonheaders.h +++ b/plugins/AVS/src/commonheaders.h @@ -109,9 +109,8 @@ extern FI_INTERFACE *fei; void mir_sleep(int time); extern bool g_shutDown; -extern char *g_szMetaName; extern TCHAR g_szDataPath[]; // user datae path (read at startup only) -extern BOOL g_MetaAvail, g_AvatarHistoryAvail; +extern BOOL g_AvatarHistoryAvail; extern HWND hwndSetMyAvatar; extern HINSTANCE g_hInst; diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 7270485770..caa11b7469 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -31,7 +31,6 @@ bool g_shutDown = false; int hLangpack; TCHAR g_szDataPath[MAX_PATH]; // user datae path (read at startup only) -BOOL g_MetaAvail = FALSE; BOOL g_AvatarHistoryAvail = FALSE; HWND hwndSetMyAvatar = 0; @@ -100,8 +99,7 @@ static TCHAR* getJGMailID(char *szProto) static int ProtocolAck(WPARAM wParam, LPARAM lParam) { ACKDATA *ack = (ACKDATA *) lParam; - - if (ack != NULL && ack->type == ACKTYPE_AVATAR && ack->hContact != 0 && (!g_MetaAvail || strcmp(ack->szModule, g_szMetaName))) { + if (ack != NULL && ack->type == ACKTYPE_AVATAR && ack->hContact != 0 && strcmp(ack->szModule, META_PROTO)) { if (ack->result == ACKRESULT_SUCCESS) { if (ack->hProcess == NULL) ProcessAvatarInfo(ack->hContact, GAIR_NOAVATAR, NULL, ack->szModule); @@ -232,7 +230,7 @@ static int ContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0; } - if (g_MetaAvail && !strcmp(cws->szModule, g_szMetaName)) { + if (!strcmp(cws->szModule, META_PROTO)) { if (lstrlenA(cws->szSetting) > 6 && !strncmp(cws->szSetting, "Status", 5)) MetaChanged(hContact, 0); } @@ -376,13 +374,6 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) g_AvatarHistoryAvail = ServiceExists(MS_AVATARHISTORY_ENABLED); - g_MetaAvail = ServiceExists(MS_MC_GETPROTOCOLNAME) ? TRUE : FALSE; - if (g_MetaAvail) { - g_szMetaName = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - if (g_szMetaName == NULL) - g_MetaAvail = FALSE; - } - PROTOACCOUNT **accs = NULL; int accCount; ProtoEnumAccounts(&accCount, &accs); diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp index d017ef3aa3..bb52ee316f 100644 --- a/plugins/AVS/src/poll.cpp +++ b/plugins/AVS/src/poll.cpp @@ -88,9 +88,8 @@ static BOOL PollProtocolCanHaveAvatar(const char *szProto) { int pCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0); int status = CallProtoService(szProto, PS_GETSTATUS, 0, 0); - return (pCaps & PF4_AVATARS) - && (g_szMetaName == NULL || strcmp(g_szMetaName, szProto)) - && ((status > ID_STATUS_OFFLINE && status != ID_STATUS_INVISIBLE) || Proto_IsFetchingWhenProtoNotVisibleAllowed(szProto)); + return (pCaps & PF4_AVATARS) && strcmp(META_PROTO, szProto) && + ((status > ID_STATUS_OFFLINE && status != ID_STATUS_INVISIBLE) || Proto_IsFetchingWhenProtoNotVisibleAllowed(szProto)); } // Return true if this protocol has to be checked diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index 721d93282e..2565b6cad7 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -508,8 +508,8 @@ protoPicCacheEntry *GetProtoDefaultAvatar(MCONTACT hContact) MCONTACT GetContactThatHaveTheAvatar(MCONTACT hContact, int locked) { - if (g_MetaAvail && db_get_b(NULL, g_szMetaName, "Enabled", 0)) { - if (db_get_dw(hContact, g_szMetaName, "NumContacts", 0) >= 1) { + if (db_get_b(NULL, META_PROTO, "Enabled", 0)) { + if (db_get_dw(hContact, META_PROTO, "NumContacts", 0) >= 1) { if (locked == -1) locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index ae493d33ad..b9d5428e65 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -29,8 +29,6 @@ DWORD mirVer; HANDLE hFolder = NULL; -char *metacontacts_proto = NULL; - TCHAR profilePath[MAX_PATH]; // database profile path (read at startup only) TCHAR basedir[MAX_PATH]; int hLangpack = 0; @@ -112,7 +110,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) if (proto == NULL) return 0; - if (metacontacts_proto != NULL && strcmp(metacontacts_proto, proto) == 0) + if (strcmp(META_PROTO, proto) == 0) return 0; DBVARIANT dbvOldHash = {0}; @@ -242,9 +240,6 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) InitPopups(); - if (ServiceExists(MS_MC_GETPROTOCOLNAME)) - metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - HookEvent(ME_AV_CONTACTAVATARCHANGED, AvatarChanged); return 0; } diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 1d5d89352b..550077b8b3 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -250,9 +250,6 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) g_SmileyAddAvail = true; - if (ServiceExists(MS_MC_GETPROTOCOLNAME)) - metaContactProto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - InitScheduler(); return 0; } diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index f9ba750500..b1d54ae4b6 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -210,7 +210,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0; _ASSERT(szProto); - if (!strcmp(szProto, (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) // workaround for metacontacts + if (!strcmp(szProto, META_PROTO)) // workaround for metacontacts return 0; sd.MirVer = db_get_s(hContact, szProto, DB_MIRVER, _T("")); diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index 3e1f3bfec6..41d53055f2 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -114,9 +114,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DEFAULT_SKIN_FOLDER "Skins\\Modern contact list" extern TCHAR SkinsFolder[MAX_PATH]; -// module name of MetaContacts plugin -extern char *g_szMetaModuleName; - //macros to free data and set it pointer to NULL #define mir_free_and_nil(x) {mir_free((void*)x); x=NULL;} // shared vars diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 8c9e5b4137..febfdd72f8 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -204,7 +204,7 @@ void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, ClcCacheEntry *pdnce, if (dat->text_use_protocol_smileys) { sp.Protocolname = pdnce->m_cache_cszProto; - if ( db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_cache_cszProto != NULL && g_szMetaModuleName && strcmp(pdnce->m_cache_cszProto, g_szMetaModuleName) == 0) { + if (db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_cache_cszProto != NULL && strcmp(pdnce->m_cache_cszProto, META_PROTO) == 0) { MCONTACT hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (LPARAM)pdnce->hContact, 0); if (hContact != 0) sp.Protocolname = GetContactProto(hContact); diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 882743d19d..971e0f1266 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -84,12 +84,8 @@ static int clcHookModulesLoaded(WPARAM wParam, LPARAM lParam) if (ServiceExists(MS_MC_DISABLEHIDDENGROUP)) CallService(MS_MC_DISABLEHIDDENGROUP, TRUE, 0); - if (ServiceExists(MS_MC_GETPROTOCOLNAME)) - g_szMetaModuleName = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); // Get icons - int i; - TCHAR szMyPath[MAX_PATH]; GetModuleFileName(g_hInst, szMyPath, SIZEOF(szMyPath)); @@ -105,7 +101,7 @@ static int clcHookModulesLoaded(WPARAM wParam, LPARAM lParam) Skin_AddIcon(&sid); sid.pszSection = LPGEN("Contact List") "/" LPGEN("Avatar Overlay"); - for (i = 0; i < SIZEOF(g_pAvatarOverlayIcons); i++) { + for (int i = 0; i < SIZEOF(g_pAvatarOverlayIcons); i++) { sid.pszDescription = g_pAvatarOverlayIcons[i].description; sid.pszName = g_pAvatarOverlayIcons[i].name; sid.iDefaultIndex = -g_pAvatarOverlayIcons[i].id; @@ -113,7 +109,7 @@ static int clcHookModulesLoaded(WPARAM wParam, LPARAM lParam) } sid.pszSection = LPGEN("Contact List") "/" LPGEN("Status Overlay"); - for (i = 0; i < SIZEOF(g_pStatusOverlayIcons); i++) { + for (int i = 0; i < SIZEOF(g_pStatusOverlayIcons); i++) { sid.pszDescription = g_pStatusOverlayIcons[i].description; sid.pszName = g_pStatusOverlayIcons[i].name; sid.iDefaultIndex = -g_pStatusOverlayIcons[i].id; @@ -201,7 +197,7 @@ static int clcHookSettingChanged(WPARAM hContact, LPARAM lParam) DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; if (hContact == NULL) { - if (g_szMetaModuleName && !mir_strcmp(cws->szModule, g_szMetaModuleName)) { + if (!mir_strcmp(cws->szModule, META_PROTO)) { if (!mir_strcmp(cws->szSetting, "Enabled")) pcli->pfnClcBroadcast(INTM_RELOADOPTIONS, hContact, lParam); } @@ -214,7 +210,7 @@ static int clcHookSettingChanged(WPARAM hContact, LPARAM lParam) { if (!strcmp(cws->szSetting, "TickTS")) pcli->pfnClcBroadcast(INTM_STATUSCHANGED, hContact, 0); - else if (g_szMetaModuleName && !strcmp(cws->szModule, g_szMetaModuleName)) { + else if (!strcmp(cws->szModule, META_PROTO)) { if (!strcmp(cws->szSetting, "Handle")) pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0); else if (!strcmp(cws->szSetting, "Default")) @@ -400,7 +396,7 @@ static LRESULT clcOnCreate(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPA dat->MetaIgnoreEmptyExtra = db_get_b(NULL, "CLC", "MetaIgnoreEmptyExtra", SETTING_METAIGNOREEMPTYEXTRA_DEFAULT); dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd, GWL_STYLE)&CLS_MANUALUPDATE)) && - g_szMetaModuleName && db_get_b(NULL, g_szMetaModuleName, "Enabled", 1) && ServiceExists(MS_MC_GETDEFAULTCONTACT); + db_get_b(NULL, META_PROTO, "Enabled", 1) && ServiceExists(MS_MC_GETDEFAULTCONTACT); dat->expandMeta = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT); dat->useMetaIcon = db_get_b(NULL, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT); @@ -1100,7 +1096,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (ServiceExists(MS_MC_ADDTOMETA)) { ClcContact *contSour; cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); - if (contSour->type == CLCIT_CONTACT && g_szMetaModuleName && mir_strcmp(contSour->proto, g_szMetaModuleName)) { + if (contSour->type == CLCIT_CONTACT && mir_strcmp(contSour->proto, META_PROTO)) { if (!contSour->isSubcontact) hNewCursor = LoadCursor(GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_DROPUSER)); /// Add to meta else @@ -1114,7 +1110,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, ClcContact *contSour, *contDest; cliGetRowByIndex(dat, dat->selection, &contDest, NULL); cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); - if (contSour->type == CLCIT_CONTACT && g_szMetaModuleName && mir_strcmp(contSour->proto, g_szMetaModuleName)) { + if (contSour->type == CLCIT_CONTACT && mir_strcmp(contSour->proto, META_PROTO)) { if (!contSour->isSubcontact) hNewCursor = LoadCursor(GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_DROPUSER)); /// Add to meta else if (contSour->subcontacts == contDest) @@ -1130,7 +1126,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, ClcContact *contSour, *contDest; cliGetRowByIndex(dat, dat->selection, &contDest, NULL); cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); - if (contSour->type == CLCIT_CONTACT && g_szMetaModuleName && mir_strcmp(contSour->proto, g_szMetaModuleName)) { + if (contSour->type == CLCIT_CONTACT && mir_strcmp(contSour->proto, META_PROTO)) { if (!contSour->isSubcontact) hNewCursor = LoadCursor(GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_DROPUSER)); /// Add to meta else if (contDest->subcontacts == contSour->subcontacts) @@ -1240,7 +1236,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, cliGetRowByIndex(dat, dat->selection, &contDest, NULL); hcontact = contSour->hContact; if (contSour->type == CLCIT_CONTACT) { - if (g_szMetaModuleName && mir_strcmp(contSour->proto, g_szMetaModuleName)) { + if (mir_strcmp(contSour->proto, META_PROTO)) { if (!contSour->isSubcontact) { MCONTACT hDest = contDest->hContact; mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be converted to MetaContact and '%s' be added to it?"), contDest->szText, contSour->szText); @@ -1272,18 +1268,18 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_ONMETACONTACT: - { - ClcContact *contDest, *contSour; - int res; - cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); - cliGetRowByIndex(dat, dat->selection, &contDest, NULL); - if (contSour->type == CLCIT_CONTACT) { - if (g_szMetaModuleName && strcmp(contSour->proto, g_szMetaModuleName)) { + { + ClcContact *contDest, *contSour; + cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); + cliGetRowByIndex(dat, dat->selection, &contDest, NULL); + if (contSour->type == CLCIT_CONTACT) { + if (!strcmp(contSour->proto, META_PROTO)) + break; if (!contSour->isSubcontact) { MCONTACT hcontact = contSour->hContact; MCONTACT handle = contDest->hContact; mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->szText); - res = MessageBox(hwnd, Wording, TranslateT("Adding contact to MetaContact"), MB_OKCANCEL | MB_ICONQUESTION); + int res = MessageBox(hwnd, Wording, TranslateT("Adding contact to MetaContact"), MB_OKCANCEL | MB_ICONQUESTION); if (res == 1) { if (!handle) return 0; CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle); @@ -1293,7 +1289,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (contSour->subcontacts == contDest) { MCONTACT hsour = contSour->hContact; mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be default?"), contSour->szText); - res = MessageBox(hwnd, Wording, TranslateT("Set default contact"), MB_OKCANCEL | MB_ICONQUESTION); + int res = MessageBox(hwnd, Wording, TranslateT("Set default contact"), MB_OKCANCEL | MB_ICONQUESTION); if (res == 1) CallService(MS_MC_SETDEFAULTCONTACT, (WPARAM)contDest->hContact, (LPARAM)hsour); } @@ -1302,7 +1298,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, MCONTACT hfrom = contSour->subcontacts->hContact; MCONTACT handle = contDest->hContact; mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be removed from MetaContact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->szText); - res = MessageBox(hwnd, Wording, TranslateT("Changing MetaContacts (Moving)"), MB_OKCANCEL | MB_ICONQUESTION); + int res = MessageBox(hwnd, Wording, TranslateT("Changing MetaContacts (Moving)"), MB_OKCANCEL | MB_ICONQUESTION); if (res == 1) { if (!handle) return 0; @@ -1313,16 +1309,16 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, } } } - } break; case DROPTARGET_ONSUBCONTACT: - { - ClcContact *contDest, *contSour; - cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); - cliGetRowByIndex(dat, dat->selection, &contDest, NULL); - if (contSour->type == CLCIT_CONTACT) { - if (g_szMetaModuleName && strcmp(contSour->proto, g_szMetaModuleName)) { + { + ClcContact *contDest, *contSour; + cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); + cliGetRowByIndex(dat, dat->selection, &contDest, NULL); + if (contSour->type == CLCIT_CONTACT) { + if (!strcmp(contSour->proto, META_PROTO)) + break; if (!contSour->isSubcontact) { MCONTACT hcontact = contSour->hContact; MCONTACT handle = contDest->subcontacts->hContact; @@ -1348,7 +1344,6 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, } } } - } break; case DROPTARGET_ONGROUP: @@ -1356,39 +1351,38 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_INSERTION: - { - ClcContact *contact, *destcontact; - ClcGroup *group, *destgroup; - BOOL NeedRename = FALSE; - TCHAR newName[128] = { 0 }; - int newIndex, i; - pcli->pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group); - i = pcli->pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup); - if (i != -1 && group->groupId != destgroup->groupId) { - TCHAR *groupName = mir_tstrdup(pcli->pfnGetGroupName(contact->groupId, 0)); - TCHAR *shortGroup = NULL; - TCHAR *sourceGrName = mir_tstrdup(pcli->pfnGetGroupName(destgroup->groupId, 0)); - if (groupName) { - int len = (int)_tcslen(groupName); - do { len--; } - while (len >= 0 && groupName[len] != '\\'); - if (len >= 0) shortGroup = groupName + len + 1; - else shortGroup = groupName; - } - if (shortGroup) { - NeedRename = TRUE; - if (sourceGrName) - mir_sntprintf(newName, SIZEOF(newName), _T("%s\\%s"), sourceGrName, shortGroup); - else - mir_sntprintf(newName, SIZEOF(newName), _T("%s"), shortGroup); + { + ClcContact *contact, *destcontact; + ClcGroup *group, *destgroup; + BOOL NeedRename = FALSE; + TCHAR newName[128] = { 0 }; + pcli->pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group); + int i = pcli->pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup); + if (i != -1 && group->groupId != destgroup->groupId) { + TCHAR *groupName = mir_tstrdup(pcli->pfnGetGroupName(contact->groupId, 0)); + TCHAR *shortGroup = NULL; + TCHAR *sourceGrName = mir_tstrdup(pcli->pfnGetGroupName(destgroup->groupId, 0)); + if (groupName) { + int len = (int)_tcslen(groupName); + do { len--; } + while (len >= 0 && groupName[len] != '\\'); + if (len >= 0) shortGroup = groupName + len + 1; + else shortGroup = groupName; + } + if (shortGroup) { + NeedRename = TRUE; + if (sourceGrName) + mir_sntprintf(newName, SIZEOF(newName), _T("%s\\%s"), sourceGrName, shortGroup); + else + mir_sntprintf(newName, SIZEOF(newName), _T("%s"), shortGroup); + } + mir_free(groupName); + mir_free(sourceGrName); } - mir_free(groupName); - mir_free(sourceGrName); + int newIndex = CallService(MS_CLIST_GROUPMOVEBEFORE, contact->groupId, (destcontact && i != -1) ? destcontact->groupId : 0); + newIndex = newIndex ? newIndex : contact->groupId; + if (NeedRename) pcli->pfnRenameGroup(newIndex, newName); } - newIndex = CallService(MS_CLIST_GROUPMOVEBEFORE, contact->groupId, (destcontact && i != -1) ? destcontact->groupId : 0); - newIndex = newIndex ? newIndex : contact->groupId; - if (NeedRename) pcli->pfnRenameGroup(newIndex, newName); - } break; case DROPTARGET_OUTSIDE: diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 240aa9c7f8..029856fada 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -197,7 +197,7 @@ static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, //Add subcontacts if (szProto) { - if ( g_szMetaModuleName && dat->IsMetaContactsEnabled && mir_strcmp(cont->proto,g_szMetaModuleName) == 0) + if (dat->IsMetaContactsEnabled && mir_strcmp(cont->proto, META_PROTO) == 0) AddSubcontacts(dat,cont,CLCItems_IsShowOfflineGroup(group)); } cont->lastPaintCounter = 0; @@ -265,7 +265,7 @@ void cli_AddContactToTree(HWND hwnd,ClcData *dat,MCONTACT hContact,int updateTot if (dat->IsMetaContactsEnabled && cacheEntry && cacheEntry->m_cache_nHiddenSubcontact) return; //contact should not be added - if (!dat->IsMetaContactsEnabled && cacheEntry && g_szMetaModuleName && !mir_strcmp(cacheEntry->m_cache_cszProto,g_szMetaModuleName)) + if (!dat->IsMetaContactsEnabled && cacheEntry && !mir_strcmp(cacheEntry->m_cache_cszProto, META_PROTO)) return; corecli.pfnAddContactToTree(hwnd,dat,hContact,updateTotalCount,checkHideOffline); @@ -398,7 +398,7 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) } if (cont) { cont->SubAllocated = 0; - if (cont->proto && g_szMetaModuleName && dat->IsMetaContactsEnabled && strcmp(cont->proto,g_szMetaModuleName) == 0) + if (cont->proto && dat->IsMetaContactsEnabled && strcmp(cont->proto, META_PROTO) == 0) AddSubcontacts(dat,cont,CLCItems_IsShowOfflineGroup(group)); } } diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index cca9ba9184..031f051d92 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -453,8 +453,10 @@ int GetDropTargetInformation(HWND hwnd,ClcData *dat,POINT pt) } dat->selection = hit; - if (g_szMetaModuleName && !mir_strcmp(contact->proto,g_szMetaModuleName) && ( ServiceExists(MS_MC_ADDTOMETA))) return DROPTARGET_ONMETACONTACT; - if (contact->isSubcontact && ( ServiceExists(MS_MC_ADDTOMETA))) return DROPTARGET_ONSUBCONTACT; + if (!mir_strcmp(contact->proto, META_PROTO) && ServiceExists(MS_MC_ADDTOMETA)) + return DROPTARGET_ONMETACONTACT; + if (contact->isSubcontact && ServiceExists(MS_MC_ADDTOMETA)) + return DROPTARGET_ONSUBCONTACT; return DROPTARGET_ONCONTACT; } COLORREF sttGetColor(char * module, char * color, COLORREF defColor) @@ -746,9 +748,8 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat ) dat->selTextColour = db_get_dw(NULL,"CLC","SelTextColour",CLCDEFAULT_MODERN_SELTEXTCOLOUR); dat->hotTextColour = db_get_dw(NULL,"CLC","HotTextColour",CLCDEFAULT_MODERN_HOTTEXTCOLOUR); dat->quickSearchColour = db_get_dw(NULL,"CLC","QuickSearchColour",CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR); - if (!g_szMetaModuleName && ServiceExists(MS_MC_GETPROTOCOLNAME)) g_szMetaModuleName = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_MANUALUPDATE)) && - g_szMetaModuleName && db_get_b(NULL,g_szMetaModuleName,"Enabled",1) && ServiceExists(MS_MC_GETDEFAULTCONTACT); + db_get_b(NULL, META_PROTO, "Enabled", 1) && ServiceExists(MS_MC_GETDEFAULTCONTACT); if (pcli->hwndContactTree == NULL || dat->hWnd == pcli->hwndContactTree) dat->MetaIgnoreEmptyExtra = db_get_b(NULL,"CLC","MetaIgnoreEmptyExtra",SETTING_METAIGNOREEMPTYEXTRA_DEFAULT); diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index 89fea99c57..b4e4d06ab1 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -87,7 +87,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact) char *szActProto = (char*)szProto; int nActStatus = nStatus; MCONTACT hActContact = hContact; - if (!db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) && g_szMetaModuleName && !mir_strcmp(szActProto,g_szMetaModuleName)) { + if (!db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) && !mir_strcmp(szActProto, META_PROTO)) { // substitute params by mostonline contact datas MCONTACT hMostOnlineContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hActContact, 0); if (hMostOnlineContact) { diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 46cde88cca..8eea4be0ea 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -259,7 +259,7 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce) if (pdnce->bIsHidden == -1) pdnce->bIsHidden = db_get_b(pdnce->hContact,"CList","Hidden",0); - pdnce->m_cache_nHiddenSubcontact = g_szMetaModuleName && db_mc_isSub(pdnce->hContact); + pdnce->m_cache_nHiddenSubcontact = db_mc_isSub(pdnce->hContact); if (pdnce->m_cache_nNoHiddenOffline == -1) pdnce->m_cache_nNoHiddenOffline = db_get_b(pdnce->hContact,"CList","noOffline",0); @@ -446,7 +446,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) // PostMessage(pcli->hwndContactTree,CLM_AUTOREBUILD, 0, 0); if (!mir_strcmp(cws->szSetting, "Status") || wildcmp(cws->szSetting, "Status?")) { - if (g_szMetaModuleName && !mir_strcmp(cws->szModule,g_szMetaModuleName) && mir_strcmp(cws->szSetting, "Status")) { + if (!mir_strcmp(cws->szModule, META_PROTO) && mir_strcmp(cws->szSetting, "Status")) { int res = 0; if (pcli->hwndContactTree && g_flag_bOnModulesLoadedCalled) res = PostAutoRebuidMessage(pcli->hwndContactTree); diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 9e677a612e..63f8bb1ad0 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -151,9 +151,6 @@ int CLUI::OnEvent_ModulesLoaded(WPARAM wParam, LPARAM lParam) if ( ServiceExists(MS_MC_DISABLEHIDDENGROUP)) CallService(MS_MC_DISABLEHIDDENGROUP, TRUE, 0); - if ( ServiceExists(MS_MC_GETPROTOCOLNAME)) - g_szMetaModuleName = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - cliCluiProtocolStatusChanged(0, 0); SleepEx(0, TRUE); g_flag_bOnModulesLoadedCalled = TRUE; diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h index 9bec318541..ffe0827255 100644 --- a/plugins/Clist_nicer/src/Include/clc.h +++ b/plugins/Clist_nicer/src/Include/clc.h @@ -223,7 +223,6 @@ struct TCluiData { int statusBarHeight; int soundsOff; BYTE tabSRMM_Avail; - BYTE bMetaAvail; BYTE bAvatarServiceAvail; HICON hIconConnecting; DWORD winFlags; @@ -285,7 +284,6 @@ struct TCluiData { DWORD stickyMaskFilter; DWORD filterFlags; COLORREF colorkey; - char szMetaName[256]; BOOL bMetaEnabled; BOOL bSecIMAvail; BOOL bNoTrayTips; diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 72a9b69df4..3fe336762a 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -151,18 +151,17 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) ReloadExtraInfo(hContact); - if (cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS) && !__strcmp(szProto, cfg::dat.szMetaName)) { + if (!(cfg::dat.dwFlags & CLUI_USEMETAICONS) && !__strcmp(szProto, META_PROTO)) if ((lstrlenA(cws->szSetting) > 6 && !strncmp(cws->szSetting, "Status", 6)) || strstr("Default,ForceSend,Nick", cws->szSetting)) pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, hContact, lParam); - } } // !!!!!!!!!!!!!!!!!! // if (cfg::dat.bMetaAvail && cfg::dat.bMetaEnabled && !__strcmp(cws->szModule, cfg::dat.szMetaName) && !__strcmp(cws->szSetting, "IsSubcontact")) // pcli->pfnClcBroadcast(INTM_HIDDENCHANGED, hContact, lParam); } } - else if (!__strcmp(cws->szModule, cfg::dat.szMetaName)) { - BYTE bMetaEnabled = cfg::getByte(cfg::dat.szMetaName, "Enabled", 1); + else if (!__strcmp(cws->szModule, META_PROTO)) { + BYTE bMetaEnabled = cfg::getByte(META_PROTO, "Enabled", 1); if (bMetaEnabled != (BYTE)cfg::dat.bMetaEnabled) { cfg::dat.bMetaEnabled = bMetaEnabled; pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); @@ -382,7 +381,7 @@ LBL_Def: if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) break; - if (contact->bIsMeta && cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { + if (contact->bIsMeta && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { contact->hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)contact->hContact, 0); contact->metaProto = GetContactProto(contact->hSubContact); contact->iImage = pcli->pfnGetContactIcon(contact->hSubContact); @@ -563,12 +562,11 @@ LBL_Def: if (!FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL)) { p = cfg::getCache(hContact, szProto); - if (!dat->bisEmbedded && cfg::dat.bMetaAvail && szProto) { // may be a subcontact, forward the xstatus + if (!dat->bisEmbedded && szProto) { // may be a subcontact, forward the xstatus if (db_mc_isSub(hContact)) { - MCONTACT hMasterContact = (MCONTACT)cfg::getDword(hContact, cfg::dat.szMetaName, "Handle", 0); + MCONTACT hMasterContact = (MCONTACT)cfg::getDword(hContact, META_PROTO, "Handle", 0); if (hMasterContact && hMasterContact != hContact) // avoid recursive call of settings handler - cfg::writeByte(hMasterContact, cfg::dat.szMetaName, "XStatusId", - (BYTE)cfg::getByte(hContact, szProto, "XStatusId", 0)); + cfg::writeByte(hMasterContact, META_PROTO, "XStatusId", (BYTE)cfg::getByte(hContact, szProto, "XStatusId", 0)); break; } } diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 15564ba4ac..cc80971641 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -101,10 +101,10 @@ int AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact) p->xStatus = cfg::getByte(hContact, p->proto, "XStatusId", 0); if (p->proto) - p->bIsMeta = !strcmp(p->proto, cfg::dat.szMetaName); + p->bIsMeta = !strcmp(p->proto, META_PROTO); else p->bIsMeta = FALSE; - if (p->bIsMeta && cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { + if (p->bIsMeta && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { p->hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0); p->metaProto = GetContactProto(p->hSubContact); p->iImage = pcli->pfnGetContactIcon(p->hSubContact); @@ -473,7 +473,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, str // always hide subcontacts (but show them on embedded contact lists) - if (cfg::dat.bMetaAvail && dat != NULL && dat->bHideSubcontacts && cfg::dat.bMetaEnabled && db_mc_isSub(hContact)) + if (dat != NULL && dat->bHideSubcontacts && cfg::dat.bMetaEnabled && db_mc_isSub(hContact)) return 1; if ( !cfg::dat.bFilterEffective) diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index 74bb93ffad..b83aa19b74 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -54,7 +54,7 @@ int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON char *szFinalProto; int finalStatus; - if (szProto != NULL && !strcmp(szProto, cfg::dat.szMetaName) && cfg::dat.bMetaAvail && hContact != 0 && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { + if (szProto != NULL && !strcmp(szProto, META_PROTO) && hContact != 0 && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { MCONTACT hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0); szFinalProto = GetContactProto(hSubContact); finalStatus = (status == 0) ? (WORD) cfg::getWord(hSubContact, szFinalProto, "Status", ID_STATUS_OFFLINE) : status; diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 28793ebcc6..73c7381fa6 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -173,15 +173,10 @@ static int systemModulesLoaded(WPARAM wParam, LPARAM lParam) { GetSystemTime(&cfg::dat.st); SystemTimeToFileTime(&cfg::dat.st, &cfg::dat.ft); - cfg::dat.bMetaAvail = ServiceExists(MS_MC_GETDEFAULTCONTACT) ? TRUE : FALSE; - if (cfg::dat.bMetaAvail) - mir_snprintf(cfg::dat.szMetaName, 256, "%s", (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0)); - else - strncpy(cfg::dat.szMetaName, "MetaContacts", 255); if (ServiceExists(MS_MC_DISABLEHIDDENGROUP)) CallService(MS_MC_DISABLEHIDDENGROUP, 1, 0); - cfg::dat.bMetaEnabled = cfg::getByte(cfg::dat.szMetaName, "Enabled", 1); + cfg::dat.bMetaEnabled = cfg::getByte(META_PROTO, "Enabled", 1); cfg::dat.bAvatarServiceAvail = ServiceExists(MS_AV_GETAVATARBITMAP) ? TRUE : FALSE; if (cfg::dat.bAvatarServiceAvail) diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 690a33e4b6..1ae8c20946 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -95,7 +95,6 @@ unsigned int nExternCount = 0; BOOL bFlashingEnabled = TRUE; BOOL bReminderDisabled = FALSE; -char *szMetaProto = NULL; BYTE bMetaProtoEnabled = 0; PLUGININFOEX pluginInfo={ @@ -126,8 +125,8 @@ BOOL CheckMsgWnd(MCONTACT, BOOL *); BOOL isMetaContactsSubContact(MCONTACT hMetaContact, MCONTACT hContact) { char *szProto = GetContactProto(hMetaContact); - if (szProto && !strcmp(szMetaProto, szProto)) { // Safety check - int i = db_get_dw(hContact, szMetaProto, "ContactNumber", -1); + if (szProto && !strcmp(META_PROTO, szProto)) { // Safety check + int i = db_get_dw(hContact, META_PROTO, "ContactNumber", -1); if (i >= 0 && hContact == (MCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hMetaContact, i)) return TRUE; } @@ -142,8 +141,8 @@ BOOL checkOpenWindow(MCONTACT hContact) return TRUE; found = CheckMsgWnd(hContact, &focus); - if (!found && szMetaProto && bMetaProtoEnabled) { - MCONTACT hMetaContact = (MCONTACT)db_get_dw(hContact, szMetaProto, "Handle", 0); + if (!found && bMetaProtoEnabled) { + MCONTACT hMetaContact = (MCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0); if (hMetaContact && isMetaContactsSubContact(hMetaContact, hContact)) found = CheckMsgWnd(hMetaContact, &focus); } @@ -260,7 +259,7 @@ BOOL metaCheckProtocol(char *szProto, MCONTACT hContact, WORD eventType) { MCONTACT hSubContact=NULL; - if (szMetaProto && bMetaProtoEnabled && szProto && !strcmp(szMetaProto, szProto)) + if (bMetaProtoEnabled && szProto && !strcmp(META_PROTO, szProto)) if (hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) szProto = GetContactProto(hSubContact); @@ -381,8 +380,8 @@ BOOL checkMsgTimestamp(HANDLE hEventCurrent, DWORD timestampCurrent) BOOL contactCheckProtocol(char *szProto, MCONTACT hContact, WORD eventType) { - if (szMetaProto && bMetaProtoEnabled && hContact) { - MCONTACT hMetaContact = (MCONTACT)db_get_dw(hContact, szMetaProto, "Handle", 0); + if (bMetaProtoEnabled && hContact) { + MCONTACT hMetaContact = (MCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0); if (hMetaContact && isMetaContactsSubContact(hMetaContact, hContact)) return FALSE; } @@ -649,8 +648,7 @@ void LoadSettings(void) ProtoList.protoInfo[i].xstatus.enabled[j] = db_get_b(NULL, KEYBDMODULE, fmtDBSettingName("%sxstatus%d", ProtoList.protoInfo[i].szProto, j), DEF_SETTING_XSTATUS); } - if (szMetaProto) - bMetaProtoEnabled = db_get_b(NULL, szMetaProto, "Enabled", 1); + bMetaProtoEnabled = db_get_b(NULL, META_PROTO, "Enabled", 1); destroyProcessList(); createProcessList(); @@ -697,10 +695,6 @@ void updateXstatusProto(PROTOCOL_INFO *protoInfo) void createProtocolList(void) { PROTOACCOUNT **proto; - - if (ServiceExists(MS_MC_GETPROTOCOLNAME)) - szMetaProto = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - ProtoEnumAccounts(&ProtoList.protoCount, &proto); ProtoList.protoInfo = (PROTOCOL_INFO *)malloc(ProtoList.protoCount * sizeof(PROTOCOL_INFO)); if (!ProtoList.protoInfo) { @@ -719,7 +713,7 @@ void createProtocolList(void) else { strcpy(ProtoList.protoInfo[i].szProto, proto[i]->szModuleName); ProtoList.protoInfo[i].enabled = FALSE; - if (szMetaProto && !strcmp(proto[i]->szModuleName, szMetaProto)) + if (!strcmp(proto[i]->szModuleName, META_PROTO)) ProtoList.protoInfo[i].visible = FALSE; else { ProtoList.protoInfo[i].visible = TRUE; diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index c6147c64c4..a187a598df 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -43,7 +43,6 @@ static HGENMENU hMainMenuGroup = NULL; static HANDLE hListeningInfoChangedEvent = NULL; static HANDLE hTTB = NULL; -static char *metacontacts_proto = NULL; BOOL loaded = FALSE; static UINT hTimer = 0; static DWORD lastInfoSetTime = 0; @@ -279,9 +278,6 @@ int ModulesLoaded(WPARAM, LPARAM) { EnableDisablePlayers(); - if (ServiceExists(MS_MC_GETPROTOCOLNAME)) - metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - // icons Icon_Register(hInst, LPGEN("ListeningTo"), iconList, SIZEOF(iconList)); diff --git a/plugins/MirOTR/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/MirOTR/src/dbfilter.cpp index 953ac2adfc..795a058c0c 100644 --- a/plugins/MirOTR/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/MirOTR/src/dbfilter.cpp @@ -61,7 +61,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) if (db_get_b(hContact, proto, "ChatRoom", 0) == 1) return 0; - if(g_metaproto && strcmp(proto, g_metaproto) == 0) { + if(strcmp(proto, META_PROTO) == 0) { hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0); if (!hContact) return 0; proto = contact_get_proto(hContact); diff --git a/plugins/MirOTR/MirOTR/src/dllmain.cpp b/plugins/MirOTR/MirOTR/src/dllmain.cpp index 232751e146..b7327db69b 100644 --- a/plugins/MirOTR/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/MirOTR/src/dllmain.cpp @@ -5,8 +5,6 @@ HANDLE hEventWindow; HINSTANCE hInst; int hLangpack; -char* g_metaproto; - PLUGININFOEX pluginInfo={ sizeof(PLUGININFOEX), @@ -33,10 +31,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfo; } -int ModulesLoaded(WPARAM wParam, LPARAM lParam) { - if(ServiceExists(MS_MC_GETPROTOCOLNAME)) - g_metaproto = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - +int ModulesLoaded(WPARAM wParam, LPARAM lParam) +{ InitUtils(); lib_cs_lock(); diff --git a/plugins/MirOTR/MirOTR/src/options.cpp b/plugins/MirOTR/MirOTR/src/options.cpp index 59e32e72b2..b54b0cb723 100644 --- a/plugins/MirOTR/MirOTR/src/options.cpp +++ b/plugins/MirOTR/MirOTR/src/options.cpp @@ -371,7 +371,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP ProtoEnumAccounts(&num_protocols, &pppDesc); for(int i = 0; i < num_protocols; i++) { - if((!g_metaproto || strcmp(pppDesc[i]->szModuleName, g_metaproto) != 0) + if((strcmp(pppDesc[i]->szModuleName, META_PROTO) != 0) && (CallProtoService(pppDesc[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) == PF1_IM) { //if (unicode) { @@ -559,7 +559,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { proto = contact_get_proto(hContact); if(proto && db_get_b(hContact, proto, "ChatRoom", 0) == 0 && CallService(MS_PROTO_ISPROTOONCONTACT, hContact, (LPARAM)MODULENAME) // ignore chatrooms - && (g_metaproto == 0 || strcmp(proto, g_metaproto) != 0)) // and MetaContacts + && strcmp(proto, META_PROTO) != 0) // and MetaContacts { lvI.iItem = 0; lvI.iSubItem = 0; diff --git a/plugins/MirOTR/MirOTR/src/options.h b/plugins/MirOTR/MirOTR/src/options.h index 27a3f06223..6f85c382d8 100644 --- a/plugins/MirOTR/MirOTR/src/options.h +++ b/plugins/MirOTR/MirOTR/src/options.h @@ -1,8 +1,6 @@ #ifndef _OPTIONS_INC #define _OPTIONS_INC -extern char* g_metaproto; - #define PRIVATE_KEY_FILENAME "otr.private_key" #define FINGERPRINT_STORE_FILENAME "otr.fingerprints" diff --git a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp index 010ef9077b..de7aa6c4e6 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp @@ -164,7 +164,7 @@ hide_all: return 0; } - if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) { + if(proto && strcmp(proto, META_PROTO) == 0) { // make menu act as per most online subcontact hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0); if (!hContact) diff --git a/plugins/MirOTR/MirOTR/src/svcs_proto.cpp b/plugins/MirOTR/MirOTR/src/svcs_proto.cpp index a9841f3e6d..9c05208b43 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_proto.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_proto.cpp @@ -12,9 +12,11 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ return CallService(MS_PROTO_CHAINSEND, wParam, lParam); char *proto = GetContactProto(ccs->hContact); - if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) // bypass for metacontacts + if(proto && strcmp(proto, META_PROTO) == 0) // bypass for metacontacts return CallService(MS_PROTO_CHAINSEND, wParam, lParam); - if (!proto || !ccs->hContact) return 1; // error + + if (!proto || !ccs->hContact) + return 1; // error gcry_error_t err; char *newmessage = 0; @@ -153,7 +155,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){ char *proto = GetContactProto(ccs->hContact); if (!proto) return 1; //error - else if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) // bypass for metacontacts + else if(proto && strcmp(proto, META_PROTO) == 0) // bypass for metacontacts return CallService(MS_PROTO_CHAINRECV, wParam, lParam); if (!ccs->hContact) return 1; //error diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index a124a2a416..420e0df05f 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -164,7 +164,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) } // ugly workaround for metacontacts, part i; store all metacontacts' events to a temporary array, so we'll be able to get the 'source' protocol when subcontact event happens later. we need the protocol to get its status and per-status settings properly - if (ServiceExists(MS_MC_GETPROTOCOLNAME) && !lstrcmpA(szProto, (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) { + if (!lstrcmpA(szProto, META_PROTO)) { // remove outdated events first DWORD CurTime = time(NULL); for (int i = MetacontactEvents.GetSize() - 1; i >= 0; i--) diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 6c9f024712..bcdfbaad92 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -28,7 +28,6 @@ LIST eventList( 10 ); HANDLE hStatusModeChange, hServiceMenu, hHookContactStatusChanged, hToolbarButton; HGENMENU hEnableDisableMenu; -char szMetaModuleName[256] = {0}; STATUS StatusList[STATUS_COUNT]; HWND SecretWnd; int hLangpack; @@ -775,7 +774,7 @@ int ContactStatusChanged(WPARAM hContact, LPARAM lParam) db_set_w(hContact, "SeenModule", "Status", oldStatus); } - if (strcmp(szProto, szMetaModuleName) == 0) { //this contact is Meta + if (!strcmp(szProto, META_PROTO)) { //this contact is Meta MCONTACT hSubContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0); hlpProto = GetContactProto(hSubContact); if (hlpProto == NULL) @@ -1138,9 +1137,6 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) if (IsAccountEnabled(accounts[i])) db_set_b(NULL, MODULE, accounts[i]->szModuleName, 0); - if (ServiceExists(MS_MC_GETPROTOCOLNAME)) - strcpy(szMetaModuleName, (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0)); - return 0; } diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index 7de32e841b..377fe2880d 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -34,7 +34,6 @@ MTEXT_INTERFACE MText = {0}; HANDLE folderId; BOOL gbPopupLoaded = FALSE; BOOL gbHppInstalled = FALSE; -LPCSTR gszMetaProto = ""; //===== Brushes, Colours and Fonts ===== HBITMAP hbmNoAvatar; diff --git a/plugins/Popup/src/config.h b/plugins/Popup/src/config.h index dcfcf7b0dd..89b670331c 100644 --- a/plugins/Popup/src/config.h +++ b/plugins/Popup/src/config.h @@ -138,8 +138,6 @@ extern HANDLE htuTitle; extern BOOL gbPopupLoaded; extern BOOL gbHppInstalled; -extern LPCSTR gszMetaProto; - //===== Brushes, Colours and Fonts ===== extern HBITMAP hbmNoAvatar; diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 8523cdf518..752ac6765b 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -264,11 +264,6 @@ static int ModulesLoaded(WPARAM,LPARAM) } else htuTitle = htuText = NULL; - // init meta contacts - INT_PTR ptr = CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - if (ptr != CALLSERVICE_NOTFOUND) - gszMetaProto = (LPCSTR)ptr; - //check if OptionLoaded if (!OptionLoaded) LoadOptions(); diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 4805337134..d824abb9b2 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -937,12 +937,12 @@ struct ReplyEditData WNDPROC oldWndProc; }; -BOOL IsUtfSendAvailable(MCONTACT hContact) +BOOL IsUtfSendAvailable(MCONTACT hContact) { char* szProto = GetContactProto(hContact); if (szProto == NULL) return FALSE; //check for MetaContact and get szProto from subcontact - if (strcmp(szProto, gszMetaProto)==0) { + if (!strcmp(szProto, META_PROTO)) { MCONTACT hSubContact = (MCONTACT)CallService(MS_MC_GETDEFAULTCONTACT, hContact, 0); if (!hSubContact) return FALSE; @@ -951,7 +951,7 @@ BOOL IsUtfSendAvailable(MCONTACT hContact) return(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDUTF) ? TRUE : FALSE; } -void AddMessageToDB(MCONTACT hContact, char *msg, int flag/*bool utf*/) +void AddMessageToDB(MCONTACT hContact, char *msg, int flag/*bool utf*/) { DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); diff --git a/plugins/QuickContacts/src/commons.h b/plugins/QuickContacts/src/commons.h index a0577d8d72..b9c41b88e9 100644 --- a/plugins/QuickContacts/src/commons.h +++ b/plugins/QuickContacts/src/commons.h @@ -58,8 +58,6 @@ Boston, MA 02111-1307, USA. // Global Variables extern HINSTANCE hInst; -extern char *metacontacts_proto; - // Copied from "../modernb/clc.h" /////////////////////////////////////////////////////////////////// diff --git a/plugins/QuickContacts/src/options.cpp b/plugins/QuickContacts/src/options.cpp index 975c4e282a..1e69ce13df 100644 --- a/plugins/QuickContacts/src/options.cpp +++ b/plugins/QuickContacts/src/options.cpp @@ -92,9 +92,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP { int ret = SaveOptsDlgProc(controls, SIZEOF(controls), MODULE_NAME, hwndDlg, msg, wParam, lParam); - switch (msg) - { - case WM_INITDIALOG: + switch (msg) { + case WM_INITDIALOG: { BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_LASTSENTTO); EnableWindow(GetDlgItem(hwndDlg, IDC_GLOBAL), enabled); @@ -102,52 +101,32 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP enabled = IsDlgButtonChecked(hwndDlg, IDC_SUBCONTACTS); EnableWindow(GetDlgItem(hwndDlg, IDC_KEEP_OFFLINE), enabled); - - if (metacontacts_proto == NULL) - { - ShowWindow(GetDlgItem(hwndDlg, IDC_SUBCONTACTS), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_KEEP_OFFLINE), SW_HIDE); - } - return TRUE; } - case WM_COMMAND: - { - if(LOWORD(wParam) == IDC_LASTSENTTO) - { - BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_LASTSENTTO); - EnableWindow(GetDlgItem(hwndDlg, IDC_GLOBAL), enabled); - EnableWindow(GetDlgItem(hwndDlg, IDC_LOCAL), enabled); - } - - if(LOWORD(wParam) == IDC_SUBCONTACTS) - { - BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_SUBCONTACTS); - EnableWindow(GetDlgItem(hwndDlg, IDC_KEEP_OFFLINE), enabled); - } + case WM_COMMAND: + if(LOWORD(wParam) == IDC_LASTSENTTO) { + BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_LASTSENTTO); + EnableWindow(GetDlgItem(hwndDlg, IDC_GLOBAL), enabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_LOCAL), enabled); + } - break; + if(LOWORD(wParam) == IDC_SUBCONTACTS) { + BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_SUBCONTACTS); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEEP_OFFLINE), enabled); } - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->idFrom) - { - case 0: - { - switch (((LPNMHDR)lParam)->code) - { - case PSN_APPLY: - { - LoadOptions(); - - return TRUE; - } - } - break; - } + break; + + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->idFrom) { + case 0: + switch (((LPNMHDR)lParam)->code) { + case PSN_APPLY: + LoadOptions(); + return TRUE; } break; } + break; } return ret; diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 0708700494..ab849acbc0 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -21,8 +21,7 @@ Boston, MA 02111-1307, USA. #include "commons.h" // Prototypes /////////////////////////////////////////////////////////////////////////// - - + PLUGININFOEX pluginInfo={ sizeof(PLUGININFOEX), __PLUGIN_NAME, @@ -37,7 +36,6 @@ PLUGININFOEX pluginInfo={ {0xf93ba59c, 0x4f48, 0x4f2e, {0x8a, 0x91, 0x77, 0xa2, 0x80, 0x15, 0x27, 0xa3}} }; - HINSTANCE hInst; HIMAGELIST hIml; int hLangpack = 0; @@ -61,14 +59,10 @@ int hksAction = 0; BOOL hasNewHotkeyModule = FALSE; -char *metacontacts_proto = NULL; - #define IDC_ICO 12344 - // Functions //////////////////////////////////////////////////////////////////////////// - BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { hInst = hinstDLL; @@ -202,8 +196,6 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) mi.ptszName = LPGENT("Quick Contacts..."); mi.pszService = MS_QC_SHOW_DIALOG; Menu_AddMainMenuItem(&mi); - - metacontacts_proto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); return 0; } @@ -343,8 +335,7 @@ void FreeContacts() void LoadContacts(HWND hwndDlg, BOOL show_all) { - BOOL metacontactsEnabled = (metacontacts_proto != NULL - && db_get_b(0, metacontacts_proto, "Enabled", 1)); + BOOL metacontactsEnabled = db_get_b(0, META_PROTO, "Enabled", 1); // Read last-sent-to contact from db and set handle as window-userdata HANDLE hlastsent = (HANDLE)db_get_dw(NULL, MODULE_NAME, "LastSentTo", -1); @@ -366,12 +357,8 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) if ((!show_all && opts.hide_subcontacts) || opts.group_append) hMeta = db_mc_getMeta(hContact); } - else - { - if (metacontacts_proto != NULL && strcmp(metacontacts_proto, pszProto) == 0) - continue; - } - + else if (!strcmp(META_PROTO, pszProto)) + continue; if (!show_all) { @@ -398,17 +385,13 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) if (!opts.keep_subcontacts_from_offline) continue; - if (GetStatus(hMeta, metacontacts_proto) > ID_STATUS_OFFLINE) - { + if (GetStatus(hMeta, META_PROTO) > ID_STATUS_OFFLINE) + continue; + + char setting[128]; + mir_snprintf(setting, sizeof(setting), "ShowOffline%s", META_PROTO); + if (db_get_b(NULL, MODULE_NAME, setting, FALSE)) continue; - } - else - { - char setting[128]; - mir_snprintf(setting, sizeof(setting), "ShowOffline%s", metacontacts_proto); - if (db_get_b(NULL, MODULE_NAME, setting, FALSE)) - continue; - } } } diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 6584212f9f..64744ac421 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -257,9 +257,7 @@ void SetStatusIcon(struct SrmmWindowData *dat) char *szProto = dat->szProto; MCONTACT hContact = dat->windowData.hContact; - char* szMetaProto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - if ((INT_PTR)szMetaProto != CALLSERVICE_NOTFOUND && strcmp(dat->szProto, szMetaProto) == 0 && - db_get_b(NULL,"CLC","Meta",0) == 0) { + if (!strcmp(dat->szProto, META_PROTO) && db_get_b(NULL,"CLC","Meta",0) == 0) { hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->windowData.hContact, 0); if (hContact != NULL) szProto = GetContactProto(hContact); diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp index 68f849dc23..403d196cfb 100644 --- a/plugins/SmileyAdd/src/general.cpp +++ b/plugins/SmileyAdd/src/general.cpp @@ -223,8 +223,7 @@ MCONTACT DecodeMetaContact(MCONTACT hContact) bool IsSmileyProto(char* proto) { - return proto && (!metaProtoName || strcmp(proto, metaProtoName)) && - (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & (PF1_IM | PF1_CHAT)); + return proto && strcmp(proto, META_PROTO) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & (PF1_IM | PF1_CHAT)); } void ReportError(const TCHAR* errmsg) diff --git a/plugins/SmileyAdd/src/general.h b/plugins/SmileyAdd/src/general.h index 5d62528903..5abb9aeddd 100644 --- a/plugins/SmileyAdd/src/general.h +++ b/plugins/SmileyAdd/src/general.h @@ -88,7 +88,6 @@ typedef WCMatcher _TMatcher; #include "smltool.h" extern HINSTANCE g_hInst; -extern char* metaProtoName; extern HANDLE hNetlibUser; extern HANDLE hEvent1; extern HGENMENU hContactMenuItem; diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index 7279cfac60..82e90f56bc 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -24,8 +24,6 @@ HINSTANCE g_hInst; HANDLE hEvent1; HGENMENU hContactMenuItem; -char* metaProtoName; - int hLangpack; static const PLUGININFOEX pluginInfoEx = @@ -54,9 +52,6 @@ static int ModulesLoaded(WPARAM, LPARAM) { Icon_Register(g_hInst, "SmileyAdd", &icon, 1); - INT_PTR temp = CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - metaProtoName = mir_strdup(temp == CALLSERVICE_NOTFOUND ? NULL : (char*)temp); - CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ROOTPOPUP; mi.popupPosition = 2000070050; @@ -143,8 +138,6 @@ extern "C" __declspec(dllexport) int Unload(void) DestroyGdiPlus(); DownloadClose(); - - mir_free(metaProtoName); return 0; } diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 66013573a2..d9a73daeec 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -770,19 +770,13 @@ void GetUserLanguageSetting(Dialog *dlg, char *setting) return; // If not found and is inside meta, try to get from the meta - INT_PTR mc = CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - if (mc != CALLSERVICE_NOTFOUND) { - char* metacontacts_proto = (char *) mc; - if (metacontacts_proto != NULL) { - MCONTACT hMetaContact = db_mc_getMeta(dlg->hContact); - if (hMetaContact != NULL) { - GetUserProtoLanguageSetting(dlg, hMetaContact, metacontacts_proto, setting); - if (dlg->lang_name[0] != _T('\0')) - return; + MCONTACT hMetaContact = db_mc_getMeta(dlg->hContact); + if (hMetaContact != NULL) { + GetUserProtoLanguageSetting(dlg, hMetaContact, META_PROTO, setting); + if (dlg->lang_name[0] != _T('\0')) + return; - GetUserProtoLanguageSetting(dlg, hMetaContact, "UserInfo", setting, FALSE); - } - } + GetUserProtoLanguageSetting(dlg, hMetaContact, "UserInfo", setting, FALSE); } } diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 9076fe0499..2f9451f2ec 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -72,7 +72,7 @@ void CContactCache::initPhaseTwo() m_Valid = (m_szProto != 0 && m_szAccount != 0) ? true : false; if (m_Valid) { - m_isMeta = PluginConfig.bMetaEnabled && !strcmp(m_szProto, PluginConfig.szMetaName); + m_isMeta = PluginConfig.bMetaEnabled && !strcmp(m_szProto, META_PROTO); m_isSubcontact = db_mc_isSub(m_hContact) != 0; if (m_isMeta) updateMeta(true); @@ -531,7 +531,7 @@ CContactCache* CContactCache::getContactCache(MCONTACT hContact) */ void CContactCache::cacheUpdateMetaChanged() { - bool fMetaActive = (PluginConfig.g_MetaContactsAvail && PluginConfig.bMetaEnabled) ? true : false; + bool fMetaActive = (PluginConfig.bMetaEnabled) ? true : false; for (int i=0; i < arContacts.getCount(); i++) { CContactCache &c = arContacts[i]; @@ -547,7 +547,7 @@ void CContactCache::cacheUpdateMetaChanged() // reset meta contact information, if metacontacts protocol became avail - if (fMetaActive && !strcmp(c.getProto(), PluginConfig.szMetaName)) + if (fMetaActive && !strcmp(c.getProto(), META_PROTO)) c.resetMeta(); } } diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 5c30455b8a..22dfafc9f1 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -2355,7 +2355,7 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) char szTemp[50]; mir_snprintf(szTemp, sizeof(szTemp), "Protocol%d", i); - ptrA szProtoName(db_get_sa(dat->hContact, PluginConfig.szMetaName, szTemp)); + ptrA szProtoName(db_get_sa(dat->hContact, META_PROTO, szTemp)); if (szProtoName == NULL) continue; @@ -2365,10 +2365,10 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) TCHAR *nick = NULL, *szStatusText = NULL; MCONTACT hContact; - if ((hContact = (MCONTACT)db_get_dw(dat->hContact, PluginConfig.szMetaName, szTemp, 0)) != 0) { + if ((hContact = (MCONTACT)db_get_dw(dat->hContact, META_PROTO, szTemp, 0)) != 0) { nick = pcli->pfnGetContactDisplayName(hContact, 0); mir_snprintf(szTemp, sizeof(szTemp), "Status%d", i); - WORD wStatus = (WORD)db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0); + WORD wStatus = (WORD)db_get_w(dat->hContact, META_PROTO, szTemp, 0); szStatusText = pcli->pfnGetStatusModeDescription(wStatus, 0); } diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 1136cdab6a..8040813d7c 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -138,16 +138,7 @@ void CGlobals::reloadSystemModulesChanged() g_iButtonsBarGap = M.GetByte("ButtonsBarGap", 1); m_hwndClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); - g_MetaContactsAvail = (ServiceExists(MS_MC_GETDEFAULTCONTACT) ? 1 : 0); - - if (g_MetaContactsAvail) { - mir_snprintf(szMetaName, 256, "%s", (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0)); - bMetaEnabled = abs(M.GetByte(szMetaName, "Enabled", -1)); - } - else { - szMetaName[0] = 0; - bMetaEnabled = 0; - } + bMetaEnabled = abs(M.GetByte(META_PROTO, "Enabled", -1)); g_PopupAvail = ServiceExists(MS_POPUP_ADDPOPUP); @@ -378,13 +369,12 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_DB_EVENT_ADDED, CMimAPI::DispatchNewEvent); HookEvent(ME_DB_EVENT_ADDED, CMimAPI::MessageEventAdded); - if (PluginConfig.g_MetaContactsAvail) { - HookEvent(ME_MC_SUBCONTACTSCHANGED, MetaContactEvent); - HookEvent(ME_MC_FORCESEND, MetaContactEvent); - HookEvent(ME_MC_UNFORCESEND, MetaContactEvent); - } HookEvent(ME_FONT_RELOAD, ::FontServiceFontsChanged); HookEvent(ME_TTB_MODULELOADED, TopToolbarLoaded); + + HookEvent(ME_MC_SUBCONTACTSCHANGED, MetaContactEvent); + HookEvent(ME_MC_FORCESEND, MetaContactEvent); + HookEvent(ME_MC_UNFORCESEND, MetaContactEvent); return 0; } @@ -434,8 +424,8 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) } if (hContact == 0 && !lstrcmpA(setting, "Enabled")) { - if (PluginConfig.g_MetaContactsAvail && !lstrcmpA(cws->szModule, PluginConfig.szMetaName)) { // catch the disabled meta contacts - PluginConfig.bMetaEnabled = abs(M.GetByte(PluginConfig.szMetaName, "Enabled", -1)); + if (!lstrcmpA(cws->szModule, META_PROTO)) { // catch the disabled meta contacts + PluginConfig.bMetaEnabled = abs(M.GetByte(META_PROTO, "Enabled", -1)); CContactCache::cacheUpdateMetaChanged(); } } @@ -443,7 +433,7 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) if (lstrcmpA(cws->szModule, "CList") && (szProto == NULL || lstrcmpA(cws->szModule, szProto))) return 0; - if (PluginConfig.g_MetaContactsAvail && !lstrcmpA(cws->szModule, PluginConfig.szMetaName)) + if (!lstrcmpA(cws->szModule, META_PROTO)) if (hContact != 0 && !lstrcmpA(setting, "Nick")) // filter out this setting to avoid infinite loops while trying to obtain the most online contact return 0; diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 79115baaaa..4ff6c49700 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -71,7 +71,7 @@ public: HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock; HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand; HBITMAP g_hbmUnknown; - int g_MetaContactsAvail, g_SmileyAddAvail, g_WantIEView, g_PopupAvail, g_WantHPP; + int g_SmileyAddAvail, g_WantIEView, g_PopupAvail, g_WantHPP; int g_FlashAvatarAvail; HIMAGELIST g_hImageList; HICON g_IconMsgEvent, g_IconTypingEvent, g_IconFileEvent, g_IconSend; @@ -138,7 +138,6 @@ public: BOOL m_autoSplit; BOOL m_FlashOnMTN; DWORD dwThreadID; - char szMetaName[256]; BYTE bMetaEnabled; HANDLE m_hMessageWindowList, hUserPrefsWindowList; HMENU m_MenuBar; diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 44c1cd65cb..c87d4aec9b 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -610,7 +610,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM lParam) bAllowAutoCreate = TRUE; else { char *szProto = GetContactProto(hContact); - if (PluginConfig.g_MetaContactsAvail && szProto && !strcmp(szProto, (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) { + if (szProto && !strcmp(szProto, META_PROTO)) { MCONTACT hSubconttact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0); szProto = GetContactProto(hSubconttact); } diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 565b685e33..8de1d4aa7e 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -3193,7 +3193,7 @@ quote_from_last: if ((isForced = M.GetDword(dat->hContact, "tabSRMM_forced", -1)) >= 0) { char szTemp[64]; mir_snprintf(szTemp, sizeof(szTemp), "Status%d", isForced); - if (db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0) == ID_STATUS_OFFLINE) + if (db_get_w(dat->hContact, META_PROTO, szTemp, 0) == ID_STATUS_OFFLINE) SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)TranslateT("Warning: you have selected a subprotocol for sending the following messages which is currently offline")); } diff --git a/plugins/TipperYM/src/common.h b/plugins/TipperYM/src/common.h index e3fc85c62b..398d4111fa 100644 --- a/plugins/TipperYM/src/common.h +++ b/plugins/TipperYM/src/common.h @@ -97,7 +97,6 @@ extern HFONT hFontTitle, hFontLabels, hFontValues, hFontTrayTitle; extern COLORREF colTitle, colLabels, colBg, colValues; extern int iCodePage; -extern char szMetaModuleName[256]; extern FI_INTERFACE *fii; diff --git a/plugins/TipperYM/src/mir_smileys.cpp b/plugins/TipperYM/src/mir_smileys.cpp index 9e19108565..f2ae1783dc 100644 --- a/plugins/TipperYM/src/mir_smileys.cpp +++ b/plugins/TipperYM/src/mir_smileys.cpp @@ -346,7 +346,7 @@ SortedList *ReplaceSmileys(const TCHAR *text, int text_size, const char *protoco if (protocol == NULL) strcpy(smileyProto, "tipper"); - else if (strcmp(protocol, szMetaModuleName) == 0) + else if (strcmp(protocol, META_PROTO) == 0) strcpy(smileyProto, "tipper"); else strcpy(smileyProto, protocol); diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 8318be45e8..a861f8fd69 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -336,7 +336,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa int iXstatus = db_get_b(pwd->hContact, szProto, "XStatusId", 0); if (iXstatus) { char szIconProto[64]; - if (strcmp(szProto, szMetaModuleName) != 0) + if (strcmp(szProto, META_PROTO) != 0) strcpy(szIconProto, szProto); else if (!db_get_s(pwd->hContact, szProto, "XStatusProto", &dbv)) { strcpy(szIconProto, dbv.pszVal); diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 68bf45606d..fe6cfe6e30 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -249,7 +249,7 @@ TCHAR *GetStatusMessageText(MCONTACT hContact) char *szProto = GetContactProto(hContact); if (szProto) { - if (!strcmp(szProto, szMetaModuleName)) + if (!strcmp(szProto, META_PROTO)) hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0); else { WORD wStatus = (int)CallProtoService(szProto, PS_GETSTATUS, 0, 0); @@ -412,8 +412,7 @@ bool GetSysSubstText(MCONTACT hContact, TCHAR *swzRawSpec, TCHAR *buff, int buff MCONTACT hTmpContact = hContact; char *szProto = GetContactProto(hContact); - if (szProto && !strcmp(szProto, szMetaModuleName)) - { + if (szProto && !strcmp(szProto, META_PROTO)) { iNumber = CallService(MS_MC_GETNUMCONTACTS, hContact, 0); hTmpContact = (MCONTACT)CallService(MS_MC_GETSUBCONTACT, hContact, 0); } diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index 822775154f..9259bb827d 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -22,8 +22,6 @@ Boston, MA 02111-1307, USA. HMODULE hInst; -char szMetaModuleName[256] = {0}; - FontIDT fontTitle, fontLabels, fontValues, fontTrayTitle; ColourIDT colourBg, colourBorder, colourAvatarBorder, colourDivider, colourSidebar; HFONT hFontTitle, hFontLabels, hFontValues, hFontTrayTitle; @@ -270,11 +268,6 @@ int ModulesLoaded(WPARAM, LPARAM) // set Miranda start timestamp db_set_dw(0, MODULE, "MirandaStartTS", (DWORD)time(0)); - - // get MetaContacts module name - if (ServiceExists(MS_MC_GETPROTOCOLNAME)) - strcpy(szMetaModuleName, (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0)); - return 0; } diff --git a/plugins/UserInfoEx/src/commonheaders.h b/plugins/UserInfoEx/src/commonheaders.h index f789243f8c..c46db24952 100644 --- a/plugins/UserInfoEx/src/commonheaders.h +++ b/plugins/UserInfoEx/src/commonheaders.h @@ -180,8 +180,6 @@ typedef struct _MGLOBAL BYTE ShowPropsheetColours : 1; // cached SET_PROPSHEET_SHOWCOLOURS database value BYTE WantAeroAdaption : 1; // reserved for later use BYTE UseDbxTree : 1; // use dbx_tree ? - LPCSTR szMetaProto; - } MGLOBAL, *LPMGLOBAL; extern HINSTANCE ghInst; diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index b46b9a635f..d9188ee74e 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -1275,9 +1275,6 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case ACKTYPE_GETINFO: // is contact the owner of the dialog or any metasubcontact of the owner? skip handling otherwise! if (ack->hContact != pPs->hContact) { - if (!myGlobals.szMetaProto) - break; - if (!db_get_b(NULL, MODNAME, SET_META_SCAN, TRUE)) break; @@ -1348,8 +1345,6 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING*)lParam; if (hContact != pPs->hContact) { - if (!myGlobals.szMetaProto) - break; if (pPs->hContact != db_mc_getMeta(hContact)) break; if (!db_get_b(NULL, MODNAME, SET_META_SCAN, TRUE)) diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index a71efbfa07..d253876279 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -484,8 +484,6 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) if (xContact == NULL) return ERROR_INVALID_PARAMS; - LPSTR pszMetaProto = myGlobals.szMetaProto ? myGlobals.szMetaProto : "MetaContacts"; - // delete last contact db_free(&_dbvUID); _hContact = INVALID_CONTACT_ID; @@ -500,9 +498,9 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) MIR_FREE(_pszUIDKey); // is contact a metacontact - if (_pszAMPro && !strcmp(_pszAMPro, pszMetaProto) /*_xmlNode->FirstChildElement(XKEY_CONTACT)*/) { + if (_pszAMPro && !strcmp(_pszAMPro, META_PROTO)) { TiXmlElement *xSub; - proto(pszMetaProto); + proto(META_PROTO); // meta contact must be uniquelly identified by its subcontacts // the metaID may change during an export or import call diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index f6b36c931f..6a5b667b26 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -329,12 +329,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar // add optional module, which is valid for at least one contact /*/Filter/*/ - if ( mir_stricmp(p, USERINFO) && - mir_stricmp(p, MOD_MBIRTHDAY) && - // Meta is only valid as base Proto at this point - mir_stricmp(p, myGlobals.szMetaProto) /*&& - mir_stricmp(p, "Protocol")*/ - ) + if (mir_stricmp(p, USERINFO) && mir_stricmp(p, MOD_MBIRTHDAY) && mir_stricmp(p, META_PROTO)) { ExportTree_AddItem(hTree, hItemOptional, p, bImagesLoaded, 1); break; diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index b2bb2f2708..63231377a0 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -71,16 +71,15 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { myGlobals.PopupActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS); - // init meta contacts - INT_PTR ptr = CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - myGlobals.szMetaProto = (ptr != CALLSERVICE_NOTFOUND) ? (LPCSTR)ptr : NULL; - // options OptionsLoadModule(); + // create services to receive string lists of languages and timezones SvcConstantsLoadModule(); + // load module to remind user about birthday and a anniversary SvcReminderOnModulesLoaded(); + // load extended intagration services SvcHomepageLoadModule(); SvcFlagsOnModulesLoaded(); diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index d759ebaf9b..17f77c8161 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -48,9 +48,6 @@ MCONTACT Sub(MCONTACT hMetaContact, int idx) MCONTACT GetMeta(MCONTACT hContact) { - if (!myGlobals.szMetaProto) - return NULL; - return db_mc_getMeta(hContact); } @@ -196,9 +193,7 @@ bool IsEmpty(MCONTACT hContact, LPCSTR pszModule) bool IsMeta(LPCSTR pszModule) { - if (myGlobals.szMetaProto) - return !mir_strcmp(pszModule, myGlobals.szMetaProto); - return !mir_strcmp(pszModule, "MetaContacts"); + return !mir_strcmp(pszModule, META_PROTO); } /** diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index aaafe6e38e..bfc97a7e93 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -431,7 +431,6 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam switch (uMsg) { case WM_INITDIALOG: TranslateDialogDefault(hDlg); - EnableDlgItem(hDlg, CHECK_OPT_METASCAN, myGlobals.szMetaProto != NULL); SendNotify_InfoChanged(hDlg); return TRUE; diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index bafb5b8a15..7011b6ed9d 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -721,9 +721,7 @@ begin result:=255; if db_mc_getMeta(hContact)<>0 then result:=2; - if StrCmp( - PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0)), - PAnsiChar(CallService(MS_MC_GETPROTOCOLNAME,0,0)))=0 then + if StrCmp(PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0)), META_PROTO)=0 then result:=1; end; if proto<>nil then diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index f47600aa5e..dd4f247020 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -186,9 +186,7 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) void registerMetaContactsTokens() { - if (ServiceExists(MS_MC_GETPROTOCOLNAME)) { - registerIntToken(MC_GETPARENT, parseGetParent, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get parent metacontact of contact x")); - registerIntToken(MC_GETDEFAULT, parseGetDefault, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get default subcontact x")); - registerIntToken(MC_GETMOSTONLINE, parseGetMostOnline, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get the 'most online' subcontact x")); - } + registerIntToken(MC_GETPARENT, parseGetParent, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get parent metacontact of contact x")); + registerIntToken(MC_GETDEFAULT, parseGetDefault, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get default subcontact x")); + registerIntToken(MC_GETMOSTONLINE, parseGetMostOnline, TRF_FUNCTION, LPGEN("MetaContacts")"\t(x)\t"LPGEN("get the 'most online' subcontact x")); } diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 77de4a71da..75160c68e2 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -392,10 +392,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count static MCONTACT gg_getsubcontact(GGPROTO* gg, MCONTACT hContact) { char* szProto = GetContactProto(hContact); - char* szMetaProto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - - if (szProto && szMetaProto && (INT_PTR)szMetaProto != CALLSERVICE_NOTFOUND && !lstrcmpA(szProto, szMetaProto)) - { + if (szProto && !lstrcmpA(szProto, META_PROTO)) { int nSubContacts = (int)CallService(MS_MC_GETNUMCONTACTS, hContact, 0), i; for (i = 0; i < nSubContacts; i++) { MCONTACT hMetaContact = (MCONTACT)CallService(MS_MC_GETSUBCONTACT, hContact, i); diff --git a/src/modules/metacontacts/meta_api.cpp b/src/modules/metacontacts/meta_api.cpp index 66760b2442..701540deae 100644 --- a/src/modules/metacontacts/meta_api.cpp +++ b/src/modules/metacontacts/meta_api.cpp @@ -177,21 +177,16 @@ INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam) { } MCONTACT hContact = (MCONTACT)db_get_dw(hMeta, META_PROTO, "ForceSend", 0); - if ( !hContact) { + if (!hContact) { if (lParam) *(DWORD *)lParam = -1; - } else { + } + else { if (lParam) *(DWORD *)lParam = (DWORD)Meta_GetContactNumber(hContact); } return 0; } -// method to get protocol name - used to be sure you're dealing with a "real" metacontacts plugin :) -// wParam=lParam=0 -INT_PTR MetaAPI_GetProtoName(WPARAM wParam, LPARAM lParam) { - return (INT_PTR)META_PROTO; -} - // added 0.9.5.0 (22/3/05) // wParam=(HANDLE)hContact // lParam=0 diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp index 73b65cea79..04f3157e44 100644 --- a/src/modules/metacontacts/meta_services.cpp +++ b/src/modules/metacontacts/meta_services.cpp @@ -1223,7 +1223,6 @@ void Meta_InitServices() CreateServiceFunction(MS_MC_FORCESENDCONTACTNUM, MetaAPI_ForceSendContactNum); CreateServiceFunction(MS_MC_FORCESENDCONTACT, MetaAPI_ForceSendContact); CreateServiceFunction(MS_MC_UNFORCESENDCONTACT, MetaAPI_UnforceSendContact); - CreateServiceFunction(MS_MC_GETPROTOCOLNAME, MetaAPI_GetProtoName); CreateServiceFunction(MS_MC_GETFORCESTATE, MetaAPI_GetForceState); CreateServiceFunction(MS_MC_CONVERTTOMETA, MetaAPI_ConvertToMeta); diff --git a/src/modules/metacontacts/metacontacts.h b/src/modules/metacontacts/metacontacts.h index cce2686c09..9124312302 100644 --- a/src/modules/metacontacts/metacontacts.h +++ b/src/modules/metacontacts/metacontacts.h @@ -20,7 +20,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define META_PROTO "MetaContacts" #define META_FILTER "MetaContactsFilter" #define META_ID "MetaID" #define META_FILTER_ID "MetaFilterID" -- cgit v1.2.3