Beispiel #1
0
void setSrmmIcon(MCONTACT h)
{
	MCONTACT hContact = metaIsProtoMetaContacts(h) ? metaGetMostOnline(h) : h;
	bool enabled = isContactSecured(hContact);	
	MCONTACT hMC = NULL;
	if(db_mc_isSub(hContact))
		hMC = db_mc_getMeta(hContact);
	else if(metaIsProtoMetaContacts(hContact))
		hMC = db_mc_getMeta(hContact);

	StatusIconData sid = { sizeof(sid) };
	sid.szModule = szGPGModuleName;
	sid.hIcon = IconLibGetIcon("secured");
	sid.dwId = 1;
	sid.flags = enabled ? 0 : MBF_HIDDEN;
	Srmm_ModifyIcon(hContact, &sid);
	if(hMC)
		Srmm_ModifyIcon(hMC, &sid);

	sid.hIcon = IconLibGetIcon("unsecured");
	sid.dwId = 2;
	sid.flags = enabled ? MBF_HIDDEN : 0;
	Srmm_ModifyIcon(hContact, &sid);
	if(hMC)
		Srmm_ModifyIcon(hMC, &sid);
}
Beispiel #2
0
HANDLE metaGetDefault(HANDLE hContact) 
{

    if(bMetaContacts)
		if(metaIsProtoMetaContacts(hContact))
			return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)hContact,0);
    return hContact;
}
Beispiel #3
0
HANDLE metaGetMostOnline(HANDLE hContact) 
{

    if(bMetaContacts)
		if(metaIsProtoMetaContacts(hContact))
			return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact,0);
    return hContact;
}
Beispiel #4
0
int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) {
	HANDLE hContact = (HANDLE)wParam;
	HANDLE hMeta = NULL;
	if(metaIsProtoMetaContacts(hContact))
	{
		hMeta = hContact;
		hContact = metaGetMostOnline(hContact); // возьмем тот, через который пойдет сообщение
	}
	else if(metaIsSubcontact(hContact))
		hMeta = metaGetContact(hContact);
	StatusIconClickData *sicd = (StatusIconClickData *)lParam;
	if(strcmp(sicd->szModule, szGPGModuleName)) 
		return 0; // not our event
	
	void setSrmmIcon(HANDLE);
	void setClistIcon(HANDLE);
	bool isContactHaveKey(HANDLE hContact);
	BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
	if(enc)
	{
		db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0);
		hMeta?db_set_b(hMeta, szGPGModuleName, "GPGEncryption", 0):0;
		setSrmmIcon(hContact);
		setClistIcon(hContact);
	}
	else if(!enc)
	{
		if(!isContactHaveKey(hContact))
		{
			void ShowLoadPublicKeyDialog();
			extern map<int, HANDLE> user_data;
			extern int item_num;
			item_num = 0;		 //black magic here
			user_data[1] = hContact;
			ShowLoadPublicKeyDialog();
		}
		else
		{
			db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1);
			hMeta?db_set_b(hMeta, szGPGModuleName, "GPGEncryption", 1):0;
			setSrmmIcon(hContact);
			setClistIcon(hContact);
			return 0;
		}
		if(isContactHaveKey(hContact))
		{
			db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1);
			hMeta?db_set_b(hMeta, szGPGModuleName, "GPGEncryption", 1):0;
			setSrmmIcon(hContact);
			setClistIcon(hContact);
		}
	}
	return 0;
}
Beispiel #5
0
void setClistIcon(MCONTACT hContact)
{
	bool enabled = isContactSecured(hContact);
	extern HANDLE g_hCLIcon;
	MCONTACT hMC = hContact;
	if(db_mc_isSub(hContact))
		hMC = db_mc_getMeta(hContact);
	else if(metaIsProtoMetaContacts(hContact))
		hMC = db_mc_getMeta(hContact);
	const char *szIconId = (enabled) ? "secured" : NULL;
	ExtraIcon_SetIcon(g_hCLIcon, hContact, szIconId);
	if(hMC)
		ExtraIcon_SetIcon(g_hCLIcon, hMC, szIconId);
}
Beispiel #6
0
MCONTACT metaGetMostOnline(MCONTACT hContact) 
{
	if(metaIsProtoMetaContacts(hContact))
		return db_mc_getMostOnline(hContact);
	return NULL;
}