From 9dbda7a1ea9d0ac91e02bf4e605618203faf83bc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 11 Nov 2015 15:06:35 +0000 Subject: thread library: - _beginthread replaced with CreateThread(); - functions forkthread & forkthreadex removed; - macroses mir_forkthread, mir_forkthreadex & mir_forkthreadowner became real functions; git-svn-id: http://svn.miranda-ng.org/main/trunk@15710 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AVS/src/main.cpp | 2 +- plugins/Clist_nicer/src/clcitems.cpp | 25 +++++++++++++------------ plugins/HTTPServer/src/main.cpp | 5 ++--- plugins/Non-IM Contact/src/timer.cpp | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) (limited to 'plugins') diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 11f0b0ec86..373f536ed4 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -43,7 +43,7 @@ HANDLE hEventChanged, hEventContactAvatarChanged, hMyAvatarChanged; void InitServices(); -static int ComparePicture(const protoPicCacheEntry* p1, const protoPicCacheEntry* p2) +static int ComparePicture(const protoPicCacheEntry *p1, const protoPicCacheEntry *p2) { if ((mir_strcmp(p1->szProtoname, "Global avatar") == 0) || strstr(p1->szProtoname, "Global avatar")) return -1; diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 6dbfb937d6..63d7141a98 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -452,14 +452,8 @@ void LoadSkinItemToCache(TExtraCache *cEntry) int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, struct ClcData *dat) { int dbHidden = cfg::getByte(hContact, "CList", "Hidden", 0); // default hidden state, always respect it. - int filterResult = 1; - DBVARIANT dbv = { 0 }; - char szTemp[64]; - TCHAR szGroupMask[256]; - DWORD dwLocalMask; // always hide subcontacts (but show them on embedded contact lists) - if (dat != NULL && dat->bHideSubcontacts && cfg::dat.bMetaEnabled && db_mc_isSub(hContact)) return 1; @@ -470,7 +464,8 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, str szProto = GetContactProto(hContact); // check stickies first (priority), only if we really have stickies defined (CLVM_STICKY_CONTACTS is set). if (cfg::dat.bFilterEffective & CLVM_STICKY_CONTACTS) { - if ((dwLocalMask = cfg::getDword(hContact, "CLVM", cfg::dat.current_viewmode, 0)) != 0) { + DWORD dwLocalMask = cfg::getDword(hContact, "CLVM", cfg::dat.current_viewmode, 0); + if (dwLocalMask != 0) { if (cfg::dat.bFilterEffective & CLVM_FILTER_STICKYSTATUS) { WORD wStatus = cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); return !((1 << (wStatus - ID_STATUS_OFFLINE)) & HIWORD(dwLocalMask)); @@ -478,31 +473,37 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, str return 0; } } + // check the proto, use it as a base filter result for all further checks + int filterResult = 1; if (cfg::dat.bFilterEffective & CLVM_FILTER_PROTOS) { + char szTemp[64]; mir_snprintf(szTemp, "%s|", szProto); filterResult = strstr(cfg::dat.protoFilter, szTemp) ? 1 : 0; } + if (cfg::dat.bFilterEffective & CLVM_FILTER_GROUPS) { - if (!cfg::getTString(hContact, "CList", "Group", &dbv)) { - mir_sntprintf(szGroupMask, _T("%s|"), &dbv.ptszVal[1]); + ptrT tszGroup(db_get_tsa(hContact, "CList", "Group")); + if (tszGroup != NULL) { + TCHAR szGroupMask[256]; + mir_sntprintf(szGroupMask, _T("%s|"), LPTSTR(tszGroup)+1); filterResult = (cfg::dat.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | (_tcsstr(cfg::dat.groupFilter, szGroupMask) ? 1 : 0)) : (filterResult & (_tcsstr(cfg::dat.groupFilter, szGroupMask) ? 1 : 0)); - mir_free(dbv.ptszVal); } else if (cfg::dat.filterFlags & CLVM_INCLUDED_UNGROUPED) filterResult = (cfg::dat.filterFlags & CLVM_PROTOGROUP_OP) ? filterResult : filterResult & 1; else filterResult = (cfg::dat.filterFlags & CLVM_PROTOGROUP_OP) ? filterResult : filterResult & 0; } + if (cfg::dat.bFilterEffective & CLVM_FILTER_STATUS) { WORD wStatus = cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); filterResult = (cfg::dat.filterFlags & CLVM_GROUPSTATUS_OP) ? ((filterResult | ((1 << (wStatus - ID_STATUS_OFFLINE)) & cfg::dat.statusMaskFilter ? 1 : 0))) : (filterResult & ((1 << (wStatus - ID_STATUS_OFFLINE)) & cfg::dat.statusMaskFilter ? 1 : 0)); } + if (cfg::dat.bFilterEffective & CLVM_FILTER_LASTMSG) { - DWORD now; TExtraCache *p = cfg::getCache(hContact, szProto); if (p) { - now = cfg::dat.t_now; + DWORD now = cfg::dat.t_now; now -= cfg::dat.lastMsgFilter; if (cfg::dat.bFilterEffective & CLVM_FILTER_LASTMSG_OLDERTHAN) filterResult = filterResult & (p->dwLastMsgTime < now); diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index 628267d374..3490f07599 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -591,11 +591,10 @@ void ConnectionOpen(HANDLE hNewConnection, DWORD dwRemoteIP) in_addr stAddr; stAddr.S_un.S_addr = htonl(dwRemoteIP); - CLHttpUser * pclUser = new CLHttpUser(hNewConnection, stAddr); - forkthread(HandleNewConnection, 0, (void*)pclUser); + CLHttpUser *pclUser = new CLHttpUser(hNewConnection, stAddr); + mir_forkthread(HandleNewConnection, pclUser); } - ///////////////////////////////////////////////////////////////////// // Member Function : nProtoAck // Type : Global diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp index f67610cae2..18fdf21778 100644 --- a/plugins/Non-IM Contact/src/timer.cpp +++ b/plugins/Non-IM Contact/src/timer.cpp @@ -51,7 +51,7 @@ void timerFunc(void*) void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) { // new thread for the timer... - forkthread(timerFunc, 0, 0); + mir_forkthread(timerFunc); } //===================================================== -- cgit v1.2.3