static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PLUGIN_DATA *pdata = (PLUGIN_DATA*)PUGetPluginData(hWnd); if (pdata == NULL) return FALSE; switch (message) { case WM_COMMAND: PopupAct(hWnd, pdata->pluginOptions->maskActL, pdata); break; case WM_CONTEXTMENU: PopupAct(hWnd, pdata->pluginOptions->maskActR, pdata); break; case UM_FREEPLUGINDATA: PopupCount--; mir_free(pdata); return TRUE; case UM_INITPOPUP: pdata->hWnd = hWnd; SetTimer(hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, NULL); break; case WM_MOUSEWHEEL: if ((short)HIWORD(wParam) > 0 && pdata->firstShowEventData->prev && (pdata->pluginOptions->bShowON || pdata->firstShowEventData->number >= pdata->pluginOptions->iNumberMsg)) { pdata->firstShowEventData = pdata->firstShowEventData->prev; PopupUpdate(pdata->hContact, NULL); } if ((short)HIWORD(wParam) < 0 && pdata->firstShowEventData->next && (!pdata->pluginOptions->bShowON || pdata->countEvent - pdata->firstShowEventData->number >= pdata->pluginOptions->iNumberMsg)) { pdata->firstShowEventData = pdata->firstShowEventData->next; PopupUpdate(pdata->hContact, NULL); } break; case WM_SETCURSOR: SetFocus(hWnd); break; case WM_TIMER: if (wParam != TIMER_TO_ACTION) break; PopupAct(hWnd, pdata->pluginOptions->maskActTE, pdata); break; } return DefWindowProc(hWnd, message, wParam, lParam); }
int HookedNewEvent(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; PLUGIN_DATA* pdata; //are popups currently enabled? if (pluginOptions.bDisable) return 0; //get DBEVENTINFO without pBlob DBEVENTINFO dbe = { sizeof(dbe) }; db_event_get((HANDLE)lParam, &dbe); //do not show popups for sub-contacts if (hContact && ServiceExists(MS_MC_GETMETACONTACT) && CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0)) return 0; //custom database event types if (ServiceExists(MS_DB_EVENT_GETTYPE)) { DBEVENTTYPEDESCR *pei = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbe.szModule, (LPARAM)dbe.eventType); // ignore events according to flags if (pei && pei->cbSize >= DBEVENTTYPEDESCR_SIZE && pei->flags & DETF_NONOTIFY) return 0; } //if event was allready read don't show it if (pluginOptions.bReadCheck && (dbe.flags & DBEF_READ)) return 0; //is it an event sent by the user? -> don't show if (dbe.flags & DBEF_SENT) { // JK, only message event, do not influence others if (pluginOptions.bHideSend && NumberPopupData(hContact, EVENTTYPE_MESSAGE) != -1) { pdata = PopupList[NumberPopupData(hContact, EVENTTYPE_MESSAGE)]; PopupAct(pdata->hWnd, MASK_DISMISS, pdata); // JK, only dismiss, i.e. do not kill event (e.g. file transfer) } return 0; } //which status do we have, are we allowed to post popups? //UNDER CONSTRUCTION!!! CallService(MS_CLIST_GETSTATUSMODE, 0, 0); /// TODO: JK: ???? if (dbe.eventType == EVENTTYPE_MESSAGE && (pluginOptions.bMsgWindowCheck && hContact && CheckMsgWnd(hContact))) return 0; //is another popup for this contact already present? -> merge message popups if enabled if (dbe.eventType == EVENTTYPE_MESSAGE && (pluginOptions.bMergePopup && NumberPopupData(hContact, EVENTTYPE_MESSAGE) != -1)) PopupUpdate(hContact, (HANDLE)lParam); else PopupShow(&pluginOptions, hContact, (HANDLE)lParam, (UINT)dbe.eventType); return 0; }