Esempio n. 1
0
// wParam is zero
// lParam is zero
INT_PTR SavePingList(WPARAM wParam, LPARAM lParam)
{
	mir_cslock lck(list_cs);
	write_ping_addresses();

	return 0;
}
Esempio n. 2
0
// wParam is zero
// lParam is zero
int SavePingList(WPARAM wParam, LPARAM lParam) {
	EnterCriticalSection(&list_cs);
	write_ping_addresses();
	LeaveCriticalSection(&list_cs);
	NotifyEventHooks(reload_event_handle, 0, 0);
	
	return 0;
}
Esempio n. 3
0
// read in addresses from old pingplug
void import_ping_addresses() {
	int count = DBGetContactSettingDword(0, "PingPlug", "NumEntries", 0);
	PINGADDRESS pa;

	EnterCriticalSection(&list_cs);
	list_items.clear();
	for(int index = 0; index < count; index++) {
		import_ping_address(index, pa);
		list_items.add(pa);
	}
	write_ping_addresses();
	LeaveCriticalSection(&list_cs);
}
Esempio n. 4
0
// read in addresses from old pingplug
void import_ping_addresses() {
	int count = DBGetContactSettingDword(0, "PingPlug", "NumEntries", 0);
	PINGADDRESS pa;

	EnterCriticalSection(&list_cs);
	list_items.clear();
	for(int index = 0; index < count; index++) {
		import_ping_address(index, pa);
		list_items.push_back(pa);
	}
	std::sort(list_items.begin(), list_items.end(), SAscendingSort());
	write_ping_addresses();
	LeaveCriticalSection(&list_cs);
}
Esempio n. 5
0
// wParam is address of a PINGLIST structure to replace the current one
// lParam is zero
INT_PTR SetAndSavePingList(WPARAM wParam, LPARAM lParam)
{
	PINGLIST *pli = (PINGLIST *)wParam;

	mir_cslock lck(list_cs);

	// set new list
	list_items = *pli;
	write_ping_addresses();

	NotifyEventHooks(reload_event_handle, 0, 0);

	return 0;
}
Esempio n. 6
0
// read in addresses from old pingplug
void import_ping_addresses()
{
	int count = db_get_dw(0, "PingPlug", "NumEntries", 0);
	PINGADDRESS pa;

	mir_cslock lck(list_cs);
	list_items.clear();
	for (int index = 0; index < count; index++)
	{
		import_ping_address(index, pa);
		list_items.push_back(pa);
	}
	write_ping_addresses();
}
Esempio n. 7
0
// wParam is address of a PINGLIST structure to replace the current one
// lParam is zero
int SetAndSavePingList(WPARAM wParam, LPARAM lParam) {
	PINGLIST *pli = (PINGLIST *)wParam;
	
	EnterCriticalSection(&list_cs);
	// delete items that aren't in the new list
	bool found;
	for(PINGLIST::iterator i = list_items.begin(); i != list_items.end(); i++) {
		found = false;
		for(PINGLIST::iterator j = pli->begin(); j != pli->end(); j++) {
			if(i->hContact == j->hContact) {
				found = true;
				break;
			}

		}
		if(!found) {
			//MessageBox(0, "Deleting contact", "Ping", MB_OK);
			// remove prot first, so that our contact deleted event handler isn't activated
			CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)i->hContact, (LPARAM)PROTO);
			CallService(MS_DB_CONTACT_DELETE, (WPARAM)i->hContact, 0);
		}
	}

	// set new list
	if(pli->size())
		list_items = *pli;
	else 
		list_items.clear();

	write_ping_addresses();
	LeaveCriticalSection(&list_cs);
	
	NotifyEventHooks(reload_event_handle, 0, 0);
	
	return 0;
}