Exemplo n.º 1
0
INT_PTR CAimProto::BlockBuddy(WPARAM wParam, LPARAM /*lParam*/)
{
	if (state != 1)	return 0;

	HANDLE hContact = (HANDLE)wParam;
	unsigned short item_id;
	DBVARIANT dbv;
	if (getString(hContact, AIM_KEY_SN, &dbv)) return 0;

	switch(pd_mode)
	{
	case 1:
		pd_mode = 4;
		aim_set_pd_info(hServerConn, seqno);

	case 4:
		item_id = block_list.find_id(dbv.pszVal);
		if (item_id != 0)
		{
			block_list.remove_by_id(item_id);
			aim_delete_contact(hServerConn, seqno, dbv.pszVal, item_id, 0, 3, false);
		}
		else
		{
			item_id = block_list.add(dbv.pszVal);
			aim_add_contact(hServerConn, seqno, dbv.pszVal, item_id, 0, 3, false);
		}
		break;

	case 2:
		pd_mode = 3;
		aim_set_pd_info(hServerConn, seqno);

	case 3:
		item_id = allow_list.find_id(dbv.pszVal);
		if (item_id != 0)
		{
			allow_list.remove_by_id(item_id);
			aim_delete_contact(hServerConn, seqno, dbv.pszVal, item_id, 0, 2, false);
		}
		else
		{
			item_id = allow_list.add(dbv.pszVal);
			aim_add_contact(hServerConn, seqno, dbv.pszVal, item_id, 0, 2);
		}
		break;
	}
	DBFreeVariant(&dbv);

	return 0;
}
Exemplo n.º 2
0
INT_PTR CAimProto::BlockBuddy(WPARAM hContact, LPARAM)
{
	if (m_state != 1)
		return 0;

	unsigned short item_id;
	DBVARIANT dbv;
	if (getString(hContact, AIM_KEY_SN, &dbv))
		return 0;

	switch (m_pd_mode) {
	case 1:
		m_pd_mode = 4;
		aim_set_pd_info(m_hServerConn, m_seqno);

	case 4:
		item_id = m_block_list.find_id(dbv.pszVal);
		if (item_id != 0) {
			m_block_list.remove_by_id(item_id);
			aim_delete_contact(m_hServerConn, m_seqno, dbv.pszVal, item_id, 0, 3, false);
		}
		else {
			item_id = m_block_list.add(dbv.pszVal);
			aim_add_contact(m_hServerConn, m_seqno, dbv.pszVal, item_id, 0, 3, false);
		}
		break;

	case 2:
		m_pd_mode = 3;
		aim_set_pd_info(m_hServerConn, m_seqno);

	case 3:
		item_id = m_allow_list.find_id(dbv.pszVal);
		if (item_id != 0) {
			m_allow_list.remove_by_id(item_id);
			aim_delete_contact(m_hServerConn, m_seqno, dbv.pszVal, item_id, 0, 2, false);
		}
		else {
			item_id = m_allow_list.add(dbv.pszVal);
			aim_add_contact(m_hServerConn, m_seqno, dbv.pszVal, item_id, 0, 2);
		}
		break;
	}
	db_free(&dbv);

	return 0;
}