Exemplo n.º 1
0
int PopupPreview(PLUGIN_OPTIONS* pluginOptions)
{
	PopupShow(pluginOptions, NULL, NULL, EVENTTYPE_MESSAGE);
	PopupShow(pluginOptions, NULL, NULL, EVENTTYPE_URL);
	PopupShow(pluginOptions, NULL, NULL, EVENTTYPE_FILE);
	PopupShow(pluginOptions, NULL, NULL, -1);
	return 0;
}
Exemplo n.º 2
0
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;
}