Ejemplo n.º 1
0
LRESULT CALLBACK HidePopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message) {
	case WM_COMMAND:
		if (HIWORD(wParam) == STN_CLICKED) {
			db_set_b(PUGetContact(hWnd), "CList", "Hidden", 1);
			PUDeletePopup(hWnd);
		}
		break;

	case WM_CONTEXTMENU:
		db_set_b(PUGetContact(hWnd), MODULENAME, "NeverHide", 1);
		PUDeletePopup(hWnd);
		break;

	case UM_POPUPACTION:
		if (wParam == 2) {
			db_set_b(PUGetContact(hWnd), "CList", "Hidden", 1);
			PUDeletePopup(hWnd);
		}
		if (wParam == 3) {
			db_set_b(PUGetContact(hWnd), MODULENAME, "NeverHide", 1);
			PUDeletePopup(hWnd);
		}
		break;

	case UM_FREEPLUGINDATA:
		return TRUE;
	}
	return DefWindowProc(hWnd, message, wParam, lParam);
}
Ejemplo n.º 2
0
static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message) {
	case WM_COMMAND:
		if (HIWORD(wParam) == STN_CLICKED) {
			CallService(MS_MSG_SENDMESSAGET, (WPARAM)PUGetContact(hWnd), 0);
			PUDeletePopup(hWnd);
			return 1;
		}
		break;

	case WM_CONTEXTMENU:
		PUDeletePopup(hWnd);
		return 1;

	case UM_INITPOPUP:
		WindowList_Add(hPopupsList, hWnd, PUGetContact(hWnd));
		return 1;

	case UM_FREEPLUGINDATA:
		WindowList_Remove(hPopupsList, hWnd);
		return 1;
	}
	return DefWindowProc(hWnd, message, wParam, lParam);
}
Ejemplo n.º 3
0
static int AwayMsgHook(WPARAM wParam, LPARAM lParam, LPARAM pObj)
{
	PLUGINDATA *pdp = (PLUGINDATA*)pObj;
	if (pdp == NULL)
		return 0;

	ACKDATA *ack = (ACKDATA *)lParam;
	if (ack->type != ACKTYPE_AWAYMSG || ack->hProcess != pdp->hAwayMsgProcess)
		return 0;

	//The first thing we go is removing the hook from the chain to avoid useless calls.
	UnhookEvent(pdp->hAwayMsgHook);
	pdp->hAwayMsgHook = NULL;

	if (ack->result != ACKRESULT_SUCCESS)
		return 0;

	MCONTACT hContact = PUGetContact(pdp->hWnd);
	ptrT pstzLast( db_get_tsa(hContact, MODULE, "LastPopupText"));

	TCHAR *tszStatus = (TCHAR*)ack->lParam;
	if (tszStatus == NULL || *tszStatus == 0)
		return 0;

	TCHAR stzText[1024];
	if (pstzLast)
		mir_sntprintf(stzText, SIZEOF(stzText), _T("%s\n%s"), pstzLast, tszStatus);
	else
		_tcsncpy(stzText, tszStatus, SIZEOF(stzText));
	SendMessage(pdp->hWnd, WM_SETREDRAW, FALSE, 0);
	PUChangeTextT(pdp->hWnd, stzText);
	SendMessage(pdp->hWnd, WM_SETREDRAW, TRUE, 0);
	return 0;
}
Ejemplo n.º 4
0
// popup dialog pocess
// for selecting actions when click on the popup window
// use for displaying contact menu
LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 
{
	DWORD ID = 0;
	MCONTACT hContact;
	hContact = PUGetContact(hWnd);

	switch(message) {
	case WM_COMMAND:
		ID = opt.LeftClickAction;
		if (ID != IDM_M7)  PUDeletePopup(hWnd);
		SendMessage(hPopupWindow, ID, hContact, 0);
		return TRUE;

	case WM_CONTEXTMENU:
		ID = opt.RightClickAction;
		if (ID != IDM_M7)  PUDeletePopup(hWnd);
		SendMessage(hPopupWindow, ID, hContact, 0);
		return TRUE;

	case UM_FREEPLUGINDATA:
		Skin_ReleaseIcon((HICON)PUGetPluginData(hWnd));
		return FALSE;
	}

	return DefWindowProc(hWnd, message, wParam, lParam);
}
Ejemplo n.º 5
0
LRESULT CALLBACK PopupDlgProcNoSet(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message) {
	case WM_COMMAND:
		if (HIWORD(wParam) == STN_CLICKED) {
			g_clistApi.pfnRemoveEvent(PUGetContact(hWnd), 0);
			CallServiceSync("BuddyExpectator/actionStillAbsent", (WPARAM)PUGetContact(hWnd), 0);
			PUDeletePopup(hWnd);
		}
		break;

	case WM_CONTEXTMENU:
		g_clistApi.pfnRemoveEvent(PUGetContact(hWnd), 0);
		PUDeletePopup(hWnd);
		break;

	case UM_FREEPLUGINDATA:
		return TRUE;
	}
	return DefWindowProc(hWnd, message, wParam, lParam);
}
Ejemplo n.º 6
0
LRESULT CALLBACK MissYouPopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message) {
	case WM_COMMAND:
		if (HIWORD(wParam) == STN_CLICKED) {
			CallServiceSync("BuddyExpectator/actionMissYou", (WPARAM)PUGetContact(hWnd), 0);
			if (!db_get_b(PUGetContact(hWnd), MODULENAME, "MissYouNotifyAlways", 0)) {
				db_set_b(PUGetContact(hWnd), MODULENAME, "MissYou", 0);
				ExtraIcon_Clear(hExtraIcon, PUGetContact(hWnd));
			}
			PUDeletePopup(hWnd);
		}
		break;

	case WM_CONTEXTMENU:
		PUDeletePopup(hWnd);
		break;

	case UM_POPUPACTION:
		if (wParam == 1) {
			db_set_b(PUGetContact(hWnd), MODULENAME, "MissYou", 0);
			ExtraIcon_Clear(hExtraIcon, PUGetContact(hWnd));
			PUDeletePopup(hWnd);
		}
		break;

	case UM_FREEPLUGINDATA:
		return TRUE;
	}
	return DefWindowProc(hWnd, message, wParam, lParam);
}
Ejemplo n.º 7
0
LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	PLUGINDATA *pdp = NULL;

	switch(message) {
	case WM_MEASUREITEM: //Needed by the contact's context menu
		return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);

	case WM_DRAWITEM: //Needed by the contact's context menu
		return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);

	case WM_COMMAND:
		//This one returns TRUE if it processed the menu command, and FALSE if it did not process it.
		if (CallServiceSync(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)PUGetContact(hwnd)))
			break;

		PopupAction(hwnd, opt.LeftClickAction);
		break;

	case WM_CONTEXTMENU:
		PopupAction(hwnd, opt.RightClickAction);
		break;

	case UM_FREEPLUGINDATA:
		pdp = (PLUGINDATA *)PUGetPluginData(hwnd);
		if (pdp != NULL) {
			if (pdp->hAwayMsgHook != NULL) {
				UnhookEvent(pdp->hAwayMsgHook);
				pdp->hAwayMsgHook = NULL;
			}

			mir_free(pdp);
		}
		return FALSE;

	case UM_INITPOPUP:
		pdp = (PLUGINDATA *)PUGetPluginData(hwnd);
		if (pdp != NULL) {
			char *szProto = GetContactProto( PUGetContact(hwnd));
			if (szProto && opt.ReadAwayMsg && StatusHasAwayMessage(szProto, pdp->newStatus)) {
				WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
				if (myStatus != ID_STATUS_INVISIBLE)
					QueryAwayMessage(hwnd, pdp);
			}
		}

		return FALSE;
	}

	return DefWindowProc(hwnd, message, wParam, lParam);
}
Ejemplo n.º 8
0
LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message) {
	case WM_COMMAND:
		if (HIWORD(wParam) == STN_CLICKED) {
			g_clistApi.pfnRemoveEvent(PUGetContact(hWnd), 0);
			CallServiceSync("BuddyExpectator/actionReturned", PUGetContact(hWnd), 0);
			PUDeletePopup(hWnd);
		}
		break;

	case WM_CONTEXTMENU:
		g_clistApi.pfnRemoveEvent(PUGetContact(hWnd), 0);
		setLastSeen(PUGetContact(hWnd));
		PUDeletePopup(hWnd);
		break;

	case UM_FREEPLUGINDATA:
		if (options.iShowEvent == 0)
			setLastSeen(PUGetContact(hWnd));
		return TRUE;
	}
	return DefWindowProc(hWnd, message, wParam, lParam);
}
Ejemplo n.º 9
0
LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

	switch (message) {
	case WM_COMMAND:
		if (HIWORD(wParam) == STN_CLICKED) {
			MCONTACT hContact = PUGetContact(hwnd);
			if (hContact > 0) CallService(MS_MSG_SENDMESSAGE, hContact, 0);
		}
	case WM_CONTEXTMENU:
		PUDeletePopup(hwnd);
		break;
	case UM_INITPOPUP: return 0;
	}
	return DefWindowProc(hwnd, message, wParam, lParam);
};
Ejemplo n.º 10
0
void QueryAwayMessage(HWND hWnd, PLUGINDATA *pdp) 
{
	HANDLE hContact = PUGetContact(hWnd);
	char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
	if (szProto) 
	{
		if ((CallProtoService(szProto, PS_GETCAPS,PFLAGNUM_1, 0) & PF1_MODEMSGRECV) &&
			(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(pdp->newStatus))) 
		{
			//The following HookEventMessage will hook the ME_PROTO_ACK event and send a WM_AWAYMSG to hWnd when the hooks get notified.
			pdp->hAwayMsgHook = HookEventMessage(ME_PROTO_ACK, hWnd, WM_AWAYMSG);
			//The following instruction asks Miranda to retrieve the away message and associates a hProcess (handle) to this request. This handle will appear in the ME_PROTO_ACK event.
			pdp->hAwayMsgProcess = (HANDLE)CallContactService(hContact, PSS_GETAWAYMSG, 0, 0);
		}
	}
}
Ejemplo n.º 11
0
LRESULT CALLBACK NudgePopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_COMMAND:
		CallService(MS_MSG_SENDMESSAGET, (WPARAM)PUGetContact(hWnd), 0);
		PUDeletePopup(hWnd);
		break;

	case WM_CONTEXTMENU:
		PUDeletePopup(hWnd);
		break;
	case UM_FREEPLUGINDATA:
		//Here we'd free our own data, if we had it.
		return FALSE;
	}
	return DefWindowProc(hWnd, msg, wParam, lParam);
}
Ejemplo n.º 12
0
void ReceivedAwayMessage(HWND hWnd, LPARAM lParam, PLUGINDATA * pdp) 
{
	HANDLE hContact = PUGetContact(hWnd);
	ACKDATA *ack = (ACKDATA *)lParam;

	if (ack->type != ACKTYPE_AWAYMSG) 
		return;

	if (ack->hProcess == pdp->hAwayMsgProcess) //It's my hProcess, so it's ok to continue.
	{
		//The first thing we go is removing the hook from the chain to avoid useless calls.
		UnhookEvent(pdp->hAwayMsgHook);
		pdp->hAwayMsgHook = NULL;

		if (ack->result != ACKRESULT_SUCCESS)
			return;

		DBVARIANT dbv;
		TCHAR stzText[MAX_SECONDLINE];

		if (!DBGetContactSettingTString(hContact, MODULE, "LastPopupText", &dbv))
		{
			_tcscpy(stzText, dbv.ptszVal);
			DBFreeVariant(&dbv);

			if (!DBGetContactSettingTString(ack->hContact, "CList", "StatusMsg", &dbv))
			{
				if (dbv.ptszVal && dbv.ptszVal[0]) 
				{
					if (stzText[0]) _tcscat(stzText, _T("\n"));
					_tcscat(stzText, dbv.ptszVal);
					SendMessage(hWnd, WM_SETREDRAW, FALSE, 0);
					PUChangeTextT(hWnd, stzText);
					SendMessage(hWnd, WM_SETREDRAW, TRUE, 0);
				}
				DBFreeVariant(&dbv);
			}

		}
	}
}
Ejemplo n.º 13
0
void PopupAction(HWND hWnd, BYTE action)
{
	HANDLE hContact = PUGetContact(hWnd);
	if (hContact && hContact != INVALID_HANDLE_VALUE)
	{
		switch (action)
		{
			case PCA_OPENMESSAGEWND:
			{
				CallServiceSync(ServiceExists("SRMsg/LaunchMessageWindow") ? "SRMsg/LaunchMessageWindow" : MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
				break;
			}
			case PCA_OPENMENU:
			{		
				POINT pt = {0};
				HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)hContact, 0);
				GetCursorPos(&pt);
				TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hWnd, NULL);
				DestroyMenu(hMenu);
				return;
			}
			case PCA_OPENDETAILS:
			{	
				CallServiceSync(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
				break;
			}
			case PCA_OPENHISTORY:
			{
				CallServiceSync(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)hContact, 0);
				break;
			}
			case PCA_CLOSEPOPUP: 
				break;
			case PCA_DONOTHING:
				return;
		}

		PUDeletePopUp(hWnd);
	}
}
Ejemplo n.º 14
0
void PopupAction(HWND hWnd, BYTE action)
{
	MCONTACT hContact = PUGetContact(hWnd);
	if (hContact && hContact != INVALID_CONTACT_ID) {
		switch (action) {
		case PCA_OPENMESSAGEWND:
			CallServiceSync(MS_MSG_SENDMESSAGET, hContact, 0);
			break;

		case PCA_OPENMENU:
			{
				POINT pt = {0};
				HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
				GetCursorPos(&pt);
				TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hWnd, NULL);
				DestroyMenu(hMenu);
			}
			return;

		case PCA_OPENDETAILS:
			CallServiceSync(MS_USERINFO_SHOWDIALOG, hContact, 0);
			break;

		case PCA_OPENHISTORY:
			CallServiceSync(MS_HISTORY_SHOWCONTACTHISTORY, hContact, 0);
			break;

		case PCA_CLOSEPOPUP:
			break;

		case PCA_DONOTHING:
			return;
		}

		PUDeletePopup(hWnd);
	}
}
Ejemplo n.º 15
0
LRESULT CALLBACK MraPopupDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	MraPopupData* dat = (MraPopupData*)PUGetPluginData(hWndDlg);

	switch (msg) {
	case UM_INITPOPUP:
		if (dat->iPopupType == MRA_POPUP_TYPE_EMAIL_STATUS) {
			// update/load avatar
			dat->ppro->MraAvatarsQueueGetAvatarSimple(dat->ppro->hAvatarsQueueHandle, GAIF_FORCE, PUGetContact(hWndDlg), 0);

			// delete old email popup
			if (dat->ppro->hWndEMailPopupStatus)
				PUDeletePopup(dat->ppro->hWndEMailPopupStatus);

			dat->ppro->hWndEMailPopupStatus = hWndDlg;
		}
		break;

	case WM_COMMAND:
		if (HIWORD(wParam) == STN_CLICKED) { //It was a click on the Popup.
			if (dat->iPopupType == MRA_POPUP_TYPE_EMAIL_STATUS) {
				CallProtoService(dat->ppro->m_szModuleName, MRA_GOTO_INBOX, 0, 0);
				dat->ppro->hWndEMailPopupStatus = NULL;
			}
		}
		PUDeletePopup(hWndDlg);
		break;

	case WM_CONTEXTMENU:
		if (dat->iPopupType == MRA_POPUP_TYPE_EMAIL_STATUS)
			dat->ppro->hWndEMailPopupStatus = NULL;
		PUDeletePopup(hWndDlg);
		break;

	case UM_FREEPLUGINDATA:
		if (dat->iPopupType == MRA_POPUP_TYPE_EMAIL_STATUS)
			dat->ppro->hWndEMailPopupStatus = NULL;
		mir_free(dat);
		break;
	}
	return DefWindowProc(hWndDlg, msg, wParam, lParam);
}