int OnWindowEvent(WPARAM wParam, LPARAM lParam) { MessageWindowEventData* msgEvData = (MessageWindowEventData*)lParam; switch (msgEvData->uType) { case MSG_WINDOW_EVT_OPENING: g_hWindows.insert(PVOID(msgEvData->hContact)); SetSrmmIcon(msgEvData->hContact); break; case MSG_WINDOW_EVT_CLOSE: if (db_get_b(NULL, ModuleName, "SweepOnClose", 0)) { CriteriaStruct Criteria; Criteria.keep = KeepCriteria(db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)); Criteria.time = BuildCriteria(db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)); SweepHistoryFromContact(msgEvData->hContact, Criteria, TRUE); } for (int i = g_hWindows.getCount() - 1; i >= 0; i--) if (g_hWindows[i] == PVOID(msgEvData->hContact)) g_hWindows.remove(i); break; } return 0; }
int OnWindowEvent(WPARAM, LPARAM lParam) { MessageWindowEventData* msgEvData = (MessageWindowEventData*)lParam; switch (msgEvData->uType) { case MSG_WINDOW_EVT_OPENING: g_hWindows.insert(PVOID(msgEvData->hContact)); SetSrmmIcon(msgEvData->hContact); break; case MSG_WINDOW_EVT_CLOSE: if (db_get_b(NULL, ModuleName, "SweepOnClose", 0)) { CriteriaStruct Criteria; Criteria.keep = KeepCriteria(db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)); Criteria.time = BuildCriteria(db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)); SweepHistoryFromContact(msgEvData->hContact, Criteria, TRUE); } auto T = g_hWindows.rev_iter(); for (auto &it : T) if (it == PVOID(msgEvData->hContact)) g_hWindows.remove(T.indexOf(&it)); break; } return 0; }
int __fastcall ApplyFingerprintImage(MCONTACT hContact, LPTSTR szMirVer) { if (hContact == NULL) return 0; HANDLE hImage = INVALID_HANDLE_VALUE; if (szMirVer) hImage = GetIconIndexFromFI(szMirVer); ExtraIcon_SetIcon(hExtraIcon, hContact, hImage); if (arMonitoredWindows.getIndex((HANDLE)hContact) != -1) SetSrmmIcon(hContact, szMirVer); MCONTACT hMeta = db_mc_getMeta(hContact); if (hMeta && db_mc_getMostOnline(hMeta) == hContact) db_set_ts(hMeta, META_PROTO, "MirVer", szMirVer); return 0; }
static int OnSrmmWindowEvent(WPARAM, LPARAM lParam) { if (!db_get_b(NULL, MODULENAME, "StatusBarIcon", 1)) return 0; MessageWindowEventData *event = (MessageWindowEventData *)lParam; if (event == NULL || event->cbSize < sizeof(MessageWindowEventData)) return 0; if (event->uType == MSG_WINDOW_EVT_OPEN) { ptrT ptszMirVer; char *szProto = GetContactProto(event->hContact); if (szProto != NULL) ptszMirVer = db_get_tsa(event->hContact, szProto, "MirVer"); SetSrmmIcon(event->hContact, ptszMirVer); arMonitoredWindows.insert((HANDLE)event->hContact); } else if (event->uType == MSG_WINDOW_EVT_CLOSE) arMonitoredWindows.remove(event->hContact); return 0; }