Exemplo n.º 1
0
void Skype::connectionDone(int error, int protocolVer) {
	kdDebug(14311) << k_funcinfo << endl;//some debug info

	if (d->pings) {
		d->pingTimer->start(1000);
	}

	if (error == seSuccess) {//It worked
		if (protocolVer < PROTOCOL_MIN) {//The protocol is too old, it is not useable
			this->error(i18n("This version of Skype is too old, consider upgrading"));
			connectionDone(seUnknown, 0);//So act like there was an error
			return;//and it is all fo now
		}

		while (d->messageQueue.size()) {//It isn't empty yet?
			QValueList<QString>::iterator it = d->messageQueue.begin();//take the first one
			d->connection << (*it);//send the message
			d->messageQueue.remove(it);//remove this one
		}
		emit updateAllContacts();//let all contacts update their information
		search("FRIENDS");//search for friends - to add them all
		TEST_QUIT;//if it failed, do not continue
		d->connection.send("GET USERSTATUS");
		TEST_QUIT;
		d->connection.send("GET CONNSTATUS");//
	} else {
		closed(crLost);//OK, this is wrong, justclose the connection/atempt and delete the queue
	}
}
Exemplo n.º 2
0
BOOL DlgOption::SubExclude::handleMsg(UINT msg, WPARAM, LPARAM lParam)
{
	switch (msg) {
	case WM_WINDOWPOSCHANGED:
		{
			RECT rClient, rWnd;

			GetClientRect(getHWnd(), &rClient);

			// clist
			rWnd = utils::getWindowRect(getHWnd(), IDC_CONTACTS);
			rWnd.right = rClient.right;
			rWnd.bottom = rClient.bottom;
			utils::moveWindow(getHWnd(), IDC_CONTACTS, rWnd);
		}
		break;

	case WM_NOTIFY:
		{
			NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
			if (p->idFrom != IDC_CONTACTS)
				break;

			HWND hCList = GetDlgItem(getHWnd(), IDC_CONTACTS);

			switch (p->code) {
			case CLN_NEWCONTACT:
			case CLN_LISTREBUILT:
				updateAllContacts(hCList);
				updateAllGroups(hCList, reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_ROOT, 0)), m_hItemAll);
				break;

			case CLN_CONTACTMOVED:
				updateAllGroups(hCList, reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_ROOT, 0)), m_hItemAll);
				break;

			case CLN_OPTIONSCHANGED:
				customizeList(hCList);
				break;

			case NM_CLICK:
				NMCLISTCONTROL* pNM = reinterpret_cast<NMCLISTCONTROL*>(p);
				if (pNM->iColumn == -1)
					break;

				DWORD dwHitFlags = 0;
				HANDLE hItem = reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_HITTEST, reinterpret_cast<WPARAM>(&dwHitFlags), MAKELPARAM(pNM->pt.x, pNM->pt.y)));
				if (!hItem || !(dwHitFlags & CLCHT_ONITEMEXTRA))
					break;

				int iImage = SendMessage(hCList, CLM_GETEXTRAIMAGE, reinterpret_cast<WPARAM>(hItem), MAKELPARAM(pNM->iColumn, 0));
				if (iImage != 0xFF) {
					iImage = (iImage == 0) ? 1 : 0;

					int itemType = SendMessage(hCList, CLM_GETITEMTYPE, reinterpret_cast<WPARAM>(hItem), 0);

					if (itemType == CLCIT_CONTACT)
						setAll(hCList, hItem, iImage, false);
					else if (itemType == CLCIT_INFO)
						setAll(hCList, hItem, iImage, true);
					else if (itemType == CLCIT_GROUP) {
						if (hItem = reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_CHILD, reinterpret_cast<LPARAM>(hItem))))
							setAll(hCList, hItem, iImage, true);
					}

					// update groups
					updateAllGroups(hCList, reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_ROOT, 0)), m_hItemAll);

					// mark as dirty
					m_bChanged = true;
					getParent()->settingsChanged();
				}
				break;
			}
		}
		break;

	case WM_DESTROY:
		IconLib::unregisterCallback(staticRecreateIcons, reinterpret_cast<LPARAM>(this));
		ImageList_Destroy(reinterpret_cast<HIMAGELIST>(SendDlgItemMessage(getHWnd(), IDC_CONTACTS, CLM_GETEXTRAIMAGELIST, 0, 0)));
		break;
	}

	return FALSE;
}