From 78dc54f9e392b45492a2b726d6268c41f594eb41 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 8 Apr 2014 17:54:19 +0000 Subject: bunch of mc related fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@8892 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AVS/src/cache.cpp | 2 +- plugins/Clist_modern/src/modern_clc.cpp | 2 +- plugins/Clist_mw/src/clc.cpp | 91 +++++++++++++++-------------- plugins/Clist_mw/src/clcitems.cpp | 7 ++- plugins/Clist_mw/src/clistmod.cpp | 9 +-- plugins/Clist_mw/src/clistsettings.cpp | 2 +- plugins/Clist_nicer/src/clc.cpp | 10 ++-- plugins/IEView/src/HTMLBuilder.cpp | 6 +- plugins/IEView/src/Options.cpp | 15 ++--- plugins/MenuItemEx/src/main.cpp | 2 +- plugins/Scriver/src/msgdialog.cpp | 4 +- plugins/Scriver/src/msglog.cpp | 2 +- plugins/Scriver/src/msgs.cpp | 2 +- plugins/SecureIM/src/crypt_metacontacts.cpp | 2 +- plugins/TabSRMM/src/hotkeyhandler.cpp | 2 +- plugins/UserInfoEx/src/svc_refreshci.cpp | 7 +-- src/core/stdmsg/src/msgdialog.cpp | 2 +- src/mir_core/mc.cpp | 4 +- 18 files changed, 83 insertions(+), 88 deletions(-) diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index 93aa9abe1d..ec4171836f 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -153,7 +153,7 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node = NULL, AVATARCACHEENTRY NotifyEventHooks(hEventChanged, hContact, (LPARAM)ace); if ((node->dwFlags & MC_ISSUBCONTACT) && db_get_b(NULL, META_PROTO, "Enabled", 0)) { - MCONTACT hMasterContact = (MCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0); + MCONTACT hMasterContact = db_mc_getMeta(hContact); if (hMasterContact && (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMasterContact, 0) == hContact && !db_get_b(hMasterContact, "ContactPhoto", "Locked", 0)) NotifyEventHooks(hEventChanged, (WPARAM)hMasterContact, (LPARAM)ace); diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index efc8646734..bd653fdc4a 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -208,7 +208,7 @@ static int clcHookSettingChanged(WPARAM hContact, LPARAM lParam) if (!strcmp(cws->szSetting, "TickTS")) pcli->pfnClcBroadcast(INTM_STATUSCHANGED, hContact, 0); else if (!strcmp(cws->szModule, META_PROTO)) { - if (!strcmp(cws->szSetting, "Handle")) + if (!strcmp(cws->szSetting, "ParentMeta")) pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0); else if (!strcmp(cws->szSetting, "Default")) pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0); diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp index 7f2c6c618d..a3c382c1cc 100644 --- a/plugins/Clist_mw/src/clc.cpp +++ b/plugins/Clist_mw/src/clc.cpp @@ -97,13 +97,13 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - if (hContact != NULL && !strcmp(cws->szModule,"MetaContacts") && !strcmp(cws->szSetting,"Handle")) - pcli->pfnClcBroadcast( INTM_NAMEORDERCHANGED, 0, 0 ); + if (hContact != NULL && !strcmp(cws->szModule, META_PROTO) && !strcmp(cws->szSetting, "ParentMeta")) + pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0); - if (hContact != NULL && !strcmp(cws->szModule,"CList")) { - if ( !strcmp( cws->szSetting, "noOffline" )) + if (hContact != NULL && !strcmp(cws->szModule, "CList")) { + if (!strcmp(cws->szSetting, "noOffline")) pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, hContact, lParam); - else if ( !strcmp(cws->szSetting,"StatusMsg")) + else if (!strcmp(cws->szSetting, "StatusMsg")) pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED, hContact, lParam); } return 0; @@ -111,12 +111,12 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) static int ClcModulesLoaded(WPARAM wParam, LPARAM lParam) { - CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)(LPGEN("Status bar background")"/StatusBar"),0); - CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)(LPGEN("List background")"/CLC"),0); - CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)(LPGEN("Frames title bar background")"/FrameTitleBar"),0); - HookEvent(ME_BACKGROUNDCONFIG_CHANGED,BgClcChange); - HookEvent(ME_BACKGROUNDCONFIG_CHANGED,BgStatusBarChange); - HookEvent(ME_BACKGROUNDCONFIG_CHANGED,OnFrameTitleBarBackgroundChange); + CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Status bar background")"/StatusBar"), 0); + CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("List background")"/CLC"), 0); + CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Frames title bar background")"/FrameTitleBar"), 0); + HookEvent(ME_BACKGROUNDCONFIG_CHANGED, BgClcChange); + HookEvent(ME_BACKGROUNDCONFIG_CHANGED, BgStatusBarChange); + HookEvent(ME_BACKGROUNDCONFIG_CHANGED, OnFrameTitleBarBackgroundChange); return 0; } @@ -129,20 +129,20 @@ static int ClcShutdown(WPARAM wParam, LPARAM lParam) LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - struct ClcData *dat = (struct ClcData*)GetWindowLongPtr(hwnd,0); - if ( msg >= CLM_FIRST && msg < CLM_LAST ) - return pcli->pfnProcessExternalMessages(hwnd,dat,msg,wParam,lParam); + struct ClcData *dat = (struct ClcData*)GetWindowLongPtr(hwnd, 0); + if (msg >= CLM_FIRST && msg < CLM_LAST) + return pcli->pfnProcessExternalMessages(hwnd, dat, msg, wParam, lParam); switch (msg) { case WM_CREATE: - dat = (struct ClcData*)mir_calloc( sizeof(struct ClcData)); - SetWindowLongPtr(hwnd,0,(LONG_PTR)dat); + dat = (struct ClcData*)mir_calloc(sizeof(struct ClcData)); + SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat); InitDisplayNameCache(&dat->lCLCContactsCache); break; case INTM_ICONCHANGED: { - int recalcScrollBar = 0,shouldShow; + int recalcScrollBar = 0, shouldShow; MCONTACT hSelItem = NULL; struct ClcContact *selcontact = NULL; ClcCacheEntry *cacheEntry = GetContactFullCacheEntry(wParam); @@ -157,14 +157,14 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L status = cacheEntry->status; // this means an offline msg is flashing, so the contact should be shown - shouldShow = (GetWindowLongPtr(hwnd,GWL_STYLE) & CLS_SHOWHIDDEN || !cacheEntry->bIsHidden) && + shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !cacheEntry->bIsHidden) && (!pcli->pfnIsHiddenMode(dat, status) || cacheEntry->noHiddenOffline || pcli->pfnGetContactIcon(wParam) != LOWORD(lParam)); ClcContact *contact; ClcGroup *group; if (!FindItem(hwnd, dat, wParam, &contact, &group, NULL)) { if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { - if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1) + if (dat->selection >= 0 && GetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact); AddContactToTree(hwnd, dat, wParam, 0, 0); needsResort = 1; @@ -179,14 +179,14 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } else { //item in list already - DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); + DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); if (contact->iImage == (WORD)lParam) break; if (sortByStatus) dat->needsResort = 1; - if ( !shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { - if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1) + if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { + if (dat->selection >= 0 && GetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact); - RemoveItemFromGroup(hwnd,group,contact,0); + RemoveItemFromGroup(hwnd, group, contact, 0); recalcScrollBar = 1; dat->needsResort = 1; } @@ -194,34 +194,35 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L int oldflags; contact->iImage = (WORD)lParam; oldflags = contact->flags; - if ( !pcli->pfnIsHiddenMode(dat,status)||cacheEntry->noHiddenOffline) contact->flags |= CONTACTF_ONLINE; + if (!pcli->pfnIsHiddenMode(dat, status) || cacheEntry->noHiddenOffline) contact->flags |= CONTACTF_ONLINE; else contact->flags &= ~CONTACTF_ONLINE; if (oldflags != contact->flags) dat->needsResort = 1; - } } + } + } if (hSelItem) { ClcGroup *selgroup; - if ( FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) - dat->selection = GetRowsPriorTo(&dat->list,selgroup,List_IndexOf((SortedList*)&selgroup->cl, selcontact)); + if (FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) + dat->selection = GetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact)); else dat->selection = -1; } SortClcByTimer(hwnd); - if (recalcScrollBar) RecalcScrollBar(hwnd,dat); + if (recalcScrollBar) RecalcScrollBar(hwnd, dat); goto LBL_Exit; } case INTM_STATUSMSGCHANGED: { DBVARIANT dbv; - if ( !(dat->style & CLS_SHOWSTATUSMESSAGES)) + if (!(dat->style & CLS_SHOWSTATUSMESSAGES)) break; ClcContact *contact; ClcGroup *group; if (FindItem(hwnd, dat, wParam, &contact, &group, NULL) && contact != NULL) { - contact->flags &= ~CONTACTF_STATUSMSG; + contact->flags &= ~CONTACTF_STATUSMSG; if (!db_get_ts(wParam, "CList", "StatusMsg", &dbv)) { int j; if (dbv.ptszVal == NULL || _tcslen(dbv.ptszVal) == 0) break; @@ -239,30 +240,30 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } } - InvalidateRect(hwnd,NULL,TRUE); + InvalidateRect(hwnd, NULL, TRUE); SortClcByTimer(hwnd); - RecalcScrollBar(hwnd,dat); + RecalcScrollBar(hwnd, dat); goto LBL_Exit; } case WM_TIMER: if (wParam == TIMERID_DELAYEDREPAINT) { - KillTimer(hwnd,TIMERID_DELAYEDREPAINT); - InvalidateRect(hwnd,NULL,FALSE); + KillTimer(hwnd, TIMERID_DELAYEDREPAINT); + InvalidateRect(hwnd, NULL, FALSE); break; } - if ( wParam == TIMERID_SUBEXPAND) { - KillTimer(hwnd,TIMERID_SUBEXPAND); + if (wParam == TIMERID_SUBEXPAND) { + KillTimer(hwnd, TIMERID_SUBEXPAND); if (hitcontact) { if (hitcontact->SubExpanded) hitcontact->SubExpanded = 0; else hitcontact->SubExpanded = 1; - db_set_b(hitcontact->hContact,"CList","Expanded",hitcontact->SubExpanded); + db_set_b(hitcontact->hContact, "CList", "Expanded", hitcontact->SubExpanded); } hitcontact = NULL; dat->needsResort = 1; - SortCLC(hwnd,dat,1); - RecalcScrollBar(hwnd,dat); + SortCLC(hwnd, dat, 1); + RecalcScrollBar(hwnd, dat); break; } break; @@ -276,7 +277,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L LRESULT res = saveContactListControlWndProc(hwnd, msg, wParam, lParam); switch (msg) { case WM_CREATE: - mir_forkthread(StatusUpdaterThread,0); + mir_forkthread(StatusUpdaterThread, 0); break; } return res; @@ -289,12 +290,12 @@ int LoadCLCModule(void) { LoadCLUIFramesModule(); - himlCListClc = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0); + himlCListClc = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0); - HookEvent(ME_SYSTEM_MODULESLOADED,ClcModulesLoaded); + HookEvent(ME_SYSTEM_MODULESLOADED, ClcModulesLoaded); hSettingChanged1 = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ClcSettingChanged); - HookEvent(ME_OPT_INITIALISE,ClcOptInit); - HookEvent(ME_SYSTEM_SHUTDOWN,ClcShutdown); + HookEvent(ME_OPT_INITIALISE, ClcOptInit); + HookEvent(ME_SYSTEM_SHUTDOWN, ClcShutdown); return 0; } @@ -306,7 +307,7 @@ static INT_PTR CLUIGetCapsService(WPARAM wParam, LPARAM lParam) case CLUICAPS_FLAGS1: return CLUIF_HIDEEMPTYGROUPS | CLUIF_DISABLEGROUPS | CLUIF_HASONTOPOPTION | CLUIF_HASAUTOHIDEOPTION; case CLUICAPS_FLAGS2: - return MAKELONG(EXTRA_ICON_COUNT,1); + return MAKELONG(EXTRA_ICON_COUNT, 1); } return 0; } diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp index 2965d4fa7b..0e67a18318 100644 --- a/plugins/Clist_mw/src/clcitems.cpp +++ b/plugins/Clist_mw/src/clcitems.cpp @@ -247,10 +247,11 @@ void AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTota return; } } - ClcContact *cont = AddContactToGroup(dat,group,cacheEntry); + + ClcContact *cont = AddContactToGroup(dat, group, cacheEntry); if (cont && cont->proto) { cont->SubAllocated = 0; - if (strcmp(cont->proto,"MetaContacts") == 0) + if (strcmp(cont->proto, META_PROTO) == 0) AddSubcontacts(cont); } if (updateTotalCount) @@ -380,7 +381,7 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) } if (cont && cont->proto) { cont->SubAllocated = 0; - if (strcmp(cont->proto,"MetaContacts") == 0) + if (strcmp(cont->proto, META_PROTO) == 0) AddSubcontacts(cont); } } diff --git a/plugins/Clist_mw/src/clistmod.cpp b/plugins/Clist_mw/src/clistmod.cpp index ce81fee4bc..7c998de4db 100644 --- a/plugins/Clist_mw/src/clistmod.cpp +++ b/plugins/Clist_mw/src/clistmod.cpp @@ -41,7 +41,6 @@ extern BYTE nameOrder[]; static HANDLE hSettingChanged, hProtoAckHook; -/////////// End by FYR //////// int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact) { int result = -1; @@ -49,7 +48,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",0) && !strcmp(szActProto,"MetaContacts")) { + if (!db_get_b(NULL, "CLC", "Meta", 0) && !strcmp(szActProto, META_PROTO)) { // substitute params by mostonline contact datas MCONTACT hMostOnlineContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hActContact, 0); if (hMostOnlineContact && hMostOnlineContact != (MCONTACT)CALLSERVICE_NOTFOUND) { @@ -67,14 +66,12 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact) // result == -1 means no Advanced icon. LOWORD(result) == 0 happens when Advanced icon returned by ICQ (i.e. no transpot) if (result == -1 || !(LOWORD(result))) - result = saveIconFromStatusMode(szActProto,nActStatus,NULL); + result = saveIconFromStatusMode(szActProto, nActStatus, NULL); } - else result = saveIconFromStatusMode(szProto,nStatus,NULL); + else result = saveIconFromStatusMode(szProto, nStatus, NULL); return result; } - -////////// By FYR///////////// int ExtIconFromStatusMode(MCONTACT hContact, const char *szProto,int status) { /* if ( db_get_b( NULL, "CLC", "Meta", 0 ) == 1 ) diff --git a/plugins/Clist_mw/src/clistsettings.cpp b/plugins/Clist_mw/src/clistsettings.cpp index 0fab2e10bd..01b42ebf6f 100644 --- a/plugins/Clist_mw/src/clistsettings.cpp +++ b/plugins/Clist_mw/src/clistsettings.cpp @@ -294,7 +294,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) else ChangeContactIcon(hContact, ExtIconFromStatusMode(hContact,cws->szModule, cws->value.wVal), 0); //by FYR } } - else if ( !strcmp(cws->szModule,"MetaContacts")) { + else if (!strcmp(cws->szModule, META_PROTO)) { pcli->pfnInitAutoRebuild(pcli->hwndContactTree); return 0; } diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index a4aecd563b..1352de08ad 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -563,12 +563,10 @@ LBL_Def: if (!FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL)) { p = cfg::getCache(hContact, szProto); if (!dat->bisEmbedded && szProto) { // may be a subcontact, forward the xstatus - if (db_mc_isSub(hContact)) { - MCONTACT hMasterContact = (MCONTACT)cfg::getDword(hContact, META_PROTO, "Handle", 0); - if (hMasterContact && hMasterContact != hContact) // avoid recursive call of settings handler - cfg::writeByte(hMasterContact, META_PROTO, "XStatusId", (BYTE)cfg::getByte(hContact, szProto, "XStatusId", 0)); - break; - } + MCONTACT hMasterContact = db_mc_getMeta(hContact); + if (hMasterContact && hMasterContact != hContact) // avoid recursive call of settings handler + cfg::writeByte(hMasterContact, META_PROTO, "XStatusId", (BYTE)cfg::getByte(hContact, szProto, "XStatusId", 0)); + break; } } else { diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index 0f035c6ebd..6557980145 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -148,7 +148,7 @@ char* HTMLBuilder::getRealProto(MCONTACT hContact) return NULL; char *szProto = mir_strdup(GetContactProto(hContact)); - if (szProto != NULL && !strcmp(szProto, "MetaContacts")) { + if (szProto != NULL && !strcmp(szProto, META_PROTO)) { hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0); if (hContact != NULL) { mir_free(szProto); @@ -160,7 +160,7 @@ char* HTMLBuilder::getRealProto(MCONTACT hContact) char *HTMLBuilder::getRealProto(MCONTACT hContact, const char *szProto) { - if (szProto != NULL && !strcmp(szProto, "MetaContacts")) { + if (szProto != NULL && !strcmp(szProto, META_PROTO)) { hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0); if (hContact != NULL) return mir_strdup(GetContactProto(hContact)); @@ -171,7 +171,7 @@ char *HTMLBuilder::getRealProto(MCONTACT hContact, const char *szProto) MCONTACT HTMLBuilder::getRealContact(MCONTACT hContact) { char *szProto = GetContactProto(hContact); - if (szProto != NULL && !strcmp(szProto,"MetaContacts")) + if (szProto != NULL && !strcmp(szProto, META_PROTO)) hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0); return hContact; } diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index 9c9959e24e..7be2656e0d 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -1481,17 +1481,18 @@ void Options::init() ProtocolSettings *proto; char tmpPath[MAX_PATH]; char dbsName[256]; - if (i==0) { + if (i == 0) { proto = new ProtocolSettings("_default_"); proto->setSRMMEnable(true); - } else if (strcmp(pProtos[i-1]->szModuleName,"MetaContacts")) { - if ((CallProtoService(pProtos[i-1]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) == 0) { + } + else if (strcmp(pProtos[i-1]->szModuleName, META_PROTO)) { + if ((CallProtoService(pProtos[i - 1]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) == 0) continue; - } - proto = new ProtocolSettings(pProtos[i-1]->szModuleName); - } else { - continue; + + proto = new ProtocolSettings(pProtos[i - 1]->szModuleName); } + else continue; + /* SRMM settings */ mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_ENABLE); proto->setSRMMEnable(i==0 ? true : 0 != db_get_b(NULL, ieviewModuleName, dbsName, FALSE)); diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index e0f9f1c1ce..f58e3c2ebe 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -262,7 +262,7 @@ void CopyToClipboard(HWND hwnd,LPSTR pszMsg, LPTSTR ptszMsg) BOOL isMetaContact(MCONTACT hContact) { char *proto = GetContactProto(hContact); - if (lstrcmpA(proto, "MetaContacts") == 0) + if (lstrcmpA(proto, META_PROTO) == 0) return TRUE; return FALSE; diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 2a1e787b1a..61c4cb3658 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1759,9 +1759,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP smaddInfo.targetMessage = EM_REPLACESEL; smaddInfo.targetWParam = TRUE; smaddInfo.Protocolname = dat->szProto; - if (dat->szProto!=NULL && strcmp(dat->szProto,"MetaContacts") == 0) { + if (dat->szProto != NULL && strcmp(dat->szProto, META_PROTO) == 0) { MCONTACT hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->windowData.hContact, 0); - if (hContact!=NULL) { + if (hContact != NULL) { smaddInfo.Protocolname = GetContactProto(hContact); } } diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index efedaa061e..2871ed490e 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -917,7 +917,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) smre.cbSize = sizeof(SMADD_RICHEDIT3); smre.hwndRichEditControl = GetDlgItem(hwndDlg, IDC_LOG); smre.Protocolname = dat->szProto; - if (dat->szProto != NULL && strcmp(dat->szProto, "MetaContacts") == 0) { + if (dat->szProto != NULL && strcmp(dat->szProto, META_PROTO) == 0) { MCONTACT hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->windowData.hContact, 0); if (hContact != NULL) smre.Protocolname = GetContactProto(hContact); diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 0a77faa6fc..8ca0b613d7 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -62,7 +62,7 @@ static int SRMMStatusToPf2(int status) int IsAutoPopup(MCONTACT hContact) { if (g_dat.flags & SMF_AUTOPOPUP) { char *szProto = GetContactProto(hContact); - if (strcmp(szProto, "MetaContacts") == 0 ) { + if (strcmp(szProto, META_PROTO) == 0) { hContact = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0); if (hContact != NULL) szProto = GetContactProto(hContact); diff --git a/plugins/SecureIM/src/crypt_metacontacts.cpp b/plugins/SecureIM/src/crypt_metacontacts.cpp index a874f5bb1c..ababa88f60 100644 --- a/plugins/SecureIM/src/crypt_metacontacts.cpp +++ b/plugins/SecureIM/src/crypt_metacontacts.cpp @@ -3,7 +3,7 @@ BOOL isProtoMetaContacts(MCONTACT hContact) { LPSTR proto = GetContactProto(hContact); - if (proto && !strcmp(proto,"MetaContacts")) + if (proto && !strcmp(proto, META_PROTO)) return true; return false; } diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index ec934bbf2a..8f06a703b7 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -73,7 +73,7 @@ static HOTKEYDESC _hotkeydescs[] = { LRESULT ProcessHotkeysByMsgFilter(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR ctrlId) { - MSGFILTER mf; + MSGFILTER mf; mf.nmhdr.code = EN_MSGFILTER; mf.nmhdr.hwndFrom = hwnd; mf.nmhdr.idFrom = ctrlId; diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index ebbcb09d65..02b5f45e90 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -691,12 +691,9 @@ public: { LPSTR pszProto = DB::Contact::Proto(hContact); - if ((mir_strcmp(pszProto, "Weather")!=0) && - (mir_strcmp(pszProto, "MetaContacts")!=0) && - IsProtoOnline(pszProto)) - { + if ((mir_strcmp(pszProto, "Weather") != 0) && (mir_strcmp(pszProto, META_PROTO) != 0) && IsProtoOnline(pszProto)) return Add(iWait, hContact); - } + return 0; } diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 2ae13f2707..7032a1478c 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -1108,7 +1108,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE); contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0); - if (strcmp(dat->szProto, "MetaContacts")) { + if (strcmp(dat->szProto, META_PROTO)) { CONTACTINFO ci = { 0 }; ci.cbSize = sizeof(ci); ci.hContact = dat->hContact; diff --git a/src/mir_core/mc.cpp b/src/mir_core/mc.cpp index 289e29e188..90e967fa98 100644 --- a/src/mir_core/mc.cpp +++ b/src/mir_core/mc.cpp @@ -74,7 +74,7 @@ MIR_CORE_DLL(void) db_mc_enable(BOOL bEnabled) MIR_CORE_DLL(BOOL) db_mc_isMeta(MCONTACT hContact) { - if (currDb == NULL) return FALSE; + if (currDb == NULL || !g_bEnabled) return FALSE; DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact); return (cc == NULL) ? FALSE : cc->nSubs != -1; @@ -82,7 +82,7 @@ MIR_CORE_DLL(BOOL) db_mc_isMeta(MCONTACT hContact) MIR_CORE_DLL(BOOL) db_mc_isSub(MCONTACT hContact) { - if (currDb == NULL) return FALSE; + if (currDb == NULL || !g_bEnabled) return FALSE; DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact); return (cc == NULL) ? FALSE : cc->parentID != 0; -- cgit v1.2.3