Esempio n. 1
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);
}
Esempio n. 2
0
// обновляет иконки в clist и в messagew
void ShowStatusIcon(HANDLE hContact, int mode)
{
	HANDLE hMC = getMetaContact(hContact);

	// обновить иконки в clist
	if (mode != -1) {
		HANDLE hIcon = mode2clicon(mode, 1);
		ExtraIcon_SetIcon(g_hCLIcon, hContact, hIcon);
		if (hMC)
			ExtraIcon_SetIcon(g_hCLIcon, hMC, hIcon);
	}
	else {
		ExtraIcon_Clear(g_hCLIcon, hContact);
		if (hMC)
			ExtraIcon_Clear(g_hCLIcon, hMC);
	}

	StatusIconData sid = { sizeof(sid) };
	sid.szModule = (char*)MODULENAME;
	for (int i = MODE_NATIVE; i < MODE_CNT; i++) {
		sid.dwId = i;
		sid.flags = (mode & SECURED) ? 0 : MBF_DISABLED;
		if (mode == -1 || (mode & 0x0f) != i || isChatRoom(hContact))
			sid.flags |= MBF_HIDDEN;  // отключаем все ненужные иконки
		Srmm_ModifyIcon(hContact, &sid);
		if (hMC)
			Srmm_ModifyIcon(hMC, &sid);
	}
}
Esempio n. 3
0
//if oldClistIcon != -1 it will remove the old location of the clist extra icon
//called with oldClistIcon != -1 from dlg_handlers whtn the extra icon slot changes.
int RefreshAllContactListIcons(int oldClistIcon)
{
	for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
		if (oldClistIcon != -1)
			ExtraIcon_Clear(hWWIExtraIcons, hContact);

		RefreshContactListIcons(hContact); //will change bBirthdayFound if needed
	}
	return 0;
}
Esempio n. 4
0
int RefreshContactListIcons(HANDLE hContact)
{
	if (hContact == 0)
		return 0;

	int count = CallService(MS_DB_CONTACT_GETCOUNT, 0, 0);
	int hidden = db_get_b(hContact, "CList", "Hidden", 0);
	int ignored = db_get_dw(hContact, "Ignore", "Mask1", 0);
	ignored = ((ignored & 0x3f) != 0) ? 1 : 0;
	int ok = 1;
	if (commonData.notifyFor & EXCLUDE_HIDDEN)
		ok &= (hidden == 0);

	if (commonData.notifyFor & EXCLUDE_IGNORED)
		ok &= (ignored == 0);

	time_t today = Today();

	int dtb = NotifyContactBirthday(hContact, today, commonData.daysInAdvance);
	int dab = NotifyMissedContactBirthday(hContact, today, commonData.daysAfter);

	if (ok && (dtb >= 0 || dab > 0)) {
		int age = GetContactAge(hContact);
		db_set_b(hContact, "UserInfo", "Age", age);

		if ((bShouldCheckBirthdays) && (commonData.bUsePopups))
		{
			if (dtb >= 0) {
				bBirthdayFound = 1; //only set it if we're called from our CheckBirthdays service
				PopupNotifyBirthday(hContact, dtb, age);
			}
			else if (dab > 0)
				PopupNotifyMissedBirthday(hContact, dab, age);
		}

		if (bShouldCheckBirthdays)
			if (dtb >= 0)
				SoundNotifyBirthday(dtb);

		if ((bShouldCheckBirthdays) && (commonData.bUseDialog)) {
			if (dtb >= 0)
				DialogNotifyBirthday(hContact, dtb, age);
			else if (dab > 0)
				DialogNotifyMissedBirthday(hContact, dab, age);
		}

		if (dtb >= 0)
			ExtraIcon_SetIcon(hWWIExtraIcons, hContact, GetDTBIconHandle(dtb));
	}
	else ExtraIcon_Clear(hWWIExtraIcons, hContact);

	return 0;
}
Esempio n. 5
0
int ExtraIconsApply(WPARAM wParam, LPARAM lParam)
{
	if (wParam == NULL)
		return 0;

	if (hasMobileClient(wParam, lParam))
		ExtraIcon_SetIcon(hExtraIcon, wParam, "mobile_icon");
	else
		ExtraIcon_Clear(hExtraIcon, wParam);

	return 0;
}
Esempio n. 6
0
void applyExtraImage(MCONTACT hContact)
{
	int ignore = isIgnored(hContact, IGNOREEVENT_ALL);
	if (ignore == 1)
		ExtraIcon_SetIconByName(hExtraIcon, hContact, "ignore_full");
	else if (ignore == 0)
		ExtraIcon_Clear(hExtraIcon, hContact);
	else if (isIgnored(hContact, IGNOREEVENT_MESSAGE))
		ExtraIcon_SetIconByName(hExtraIcon, hContact, "ignore_mess");
	else
		ExtraIcon_SetIconByName(hExtraIcon, hContact, "ignore_part");
}
Esempio n. 7
0
/**
 * Menu item click action
 */
INT_PTR MenuMissYouClick(WPARAM hContact, LPARAM)
{
	if (db_get_b(hContact, MODULENAME, "MissYou", 0)) {
		db_set_b(hContact, MODULENAME, "MissYou", 0);
		ExtraIcon_Clear(hExtraIcon, hContact);
	}
	else {
		db_set_b(hContact, MODULENAME, "MissYou", 1);
		ExtraIcon_SetIconByName(hExtraIcon, hContact, "enabled_icon");
	}

	return 0;
}
Esempio n. 8
0
static void CALLBACK SetExtraImage(MCONTACT hContact)
{
	if (!bShowExtraIcon)
		return;
		
	int countryNumber = ServiceDetectContactOriginCountry(hContact, 0);
	if (countryNumber == 0xFFFF && !bUseUnknown)
		ExtraIcon_Clear(hExtraIcon, hContact);
	else {
		char szId[20];
		mir_snprintf(szId, SIZEOF(szId), (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber);
		ExtraIcon_SetIcon(hExtraIcon, hContact, szId);
	}
}
Esempio n. 9
0
void remove_ES_icons(CAimProto* ppro)
{
	for (MCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName))
		if (!ppro->isChatRoom(hContact)) 
			ExtraIcon_Clear(hExtraES, hContact);
}
Esempio n. 10
0
// always call in context of main thread
static void RemoveExtraImages(void)
{
	for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
		ExtraIcon_Clear(hExtraIcon, hContact);
}