Ejemplo n.º 1
0
void KaduExtInfo::openMailComposer(const QString &link)
{
    kdebugf();
    QProcess *browser;
    QStringList args;
    QString mail = link;

    QString mailComposer = mailProgram;
    if (mailProgram.isEmpty())
    {
        /*QMessageBox::warning(0, qApp->translate("@default", QT_TR_NOOP("WWW error")),
            qApp->translate("@default", QT_TR_NOOP("Web browser was not specified. Visit the configuration section")));*/
        kdebugmf(KDEBUG_INFO, "Mail composer NOT specified.\n");
        return;
    }
    if (!mailComposer.contains("%1"))
        mailComposer.append(" \"%1\"");

    mail.replace("mailto:","");
    mailComposer.replace("%1", unicode2latinUrl(mail));

    args=toStringList("sh", "-c", mailComposer);

    CONST_FOREACH(i, args)
        kdebugmf(KDEBUG_INFO, "%s\n", (*i).local8Bit().data());
    browser = new QProcess(qApp);
    browser->setArguments(args);
    QObject::connect(browser, SIGNAL(processExited()), browser, SLOT(deleteLater()));

    if (!browser->start())
        QMessageBox::critical(0, tr("Mail error"), tr("Could not spawn Mail composer process. Check if the Mail program is functional"));

    kdebugf2();
}
Ejemplo n.º 2
0
void GaduContactListService::handleEventUserlistGetReply(struct gg_event *e)
{
	char *content = e->event.userlist.reply;
	if (!content)
	{
		kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "error!\n");

		emit contactListImported(false, BuddyList());
		return;
	}

	if (content[0] != 0)
		ImportReply.append(content);

	if (e->event.userlist.type == GG_USERLIST_GET_MORE_REPLY)
	{
		kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "next portion\n");
		return;
	}

	kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "\n%s\n", ImportReply.data());

	BuddyList buddies = GaduListHelper::byteArrayToBuddyList(Protocol->account(), ImportReply);
	emit contactListImported(true, buddies);

	// cleanup references, so buddy and contact instances can be removed
	// this is really a hack, we need to call aboutToBeRemoved someway for non-manager contacts and buddies too
	// or just only store managed only, i dont know yet
	foreach (Buddy buddy, buddies)
	{
		foreach (Contact contact, buddy.contacts())
			contact.data()->aboutToBeRemoved();
		buddy.data()->aboutToBeRemoved();
	}
Ejemplo n.º 3
0
void GaduPubdirSocketNotifiers::socketEvent()
{
	kdebugf();

	if (gg_pubdir_watch_fd(H) == -1)
	{
		finished(false);
		return;
	}

	struct gg_pubdir *p = (struct gg_pubdir *)H->data;

	switch (H->state)
	{
		case GG_STATE_CONNECTING:
			kdebugmf(KDEBUG_NETWORK | KDEBUG_INFO, "changing QSocketNotifiers\n");
			watchFor(H);
			break;

		case GG_STATE_ERROR:
			kdebugmf(KDEBUG_NETWORK | KDEBUG_INFO, "error!\n");
			finished(false);
			break;

		case GG_STATE_DONE:
			if (p->success)
				kdebugmf(KDEBUG_NETWORK | KDEBUG_INFO,  "success!\n");
			else
			kdebugmf(KDEBUG_NETWORK | KDEBUG_INFO, "error!\n");
			finished(p->success);
			break;
	}

	kdebugf2();
}
Ejemplo n.º 4
0
bool GaduChatService::sendMessage(const Chat &chat, FormattedMessage &message, bool silent)
{
	kdebugf();

	QString plain = message.toPlain();
	QList<Contact> contacts = chat.contacts().toContactList();

	if (plain.isEmpty()) // for image sending
		message.prepend(FormattedMessagePart(" ", false, false, false, QColor(0, 0, 0)));

	unsigned int uinsCount = 0;
	unsigned int formatsSize = 0;
	QScopedArrayPointer<unsigned char> formats(GaduFormatter::createFormats(Protocol->account(), message, formatsSize));
	bool stop = false;

	kdebugmf(KDEBUG_INFO, "\n%s\n", (const char *)unicode2latin(plain));

	QByteArray data = plain.toUtf8();

	emit filterRawOutgoingMessage(chat, data, stop);
	plain = QString::fromUtf8(data);
	emit filterOutgoingMessage(chat, plain, stop);

	if (stop)
	{
		kdebugmf(KDEBUG_FUNCTION_END, "end: filter stopped processing\n");
		return false;
	}

	if (data.length() >= 2000)
	{
		MessageDialog::show("dialog-warning", tr("Kadu"), tr("Filtered message too long (%1>=%2)").arg(data.length()).arg(2000));
		kdebugmf(KDEBUG_FUNCTION_END, "end: filtered message too long\n");
		return false;
	}

	uinsCount = contacts.count();

	int messageId = -1;
	if (uinsCount > 1)
	{
		QScopedArrayPointer<UinType> uins(new UinType[uinsCount]);
		unsigned int i = 0;

		foreach (const Contact &contact, contacts)
			uins[i++] = Protocol->uin(contact);

		if (formatsSize)
			messageId = gg_send_message_confer_richtext(
					Protocol->gaduSession(), GG_CLASS_CHAT, uinsCount, uins.data(), (unsigned char *)data.data(),
					formats.data(), formatsSize);
		else
			messageId = gg_send_message_confer(
					Protocol->gaduSession(), GG_CLASS_CHAT, uinsCount, uins.data(), (unsigned char *)data.data());
	}
Ejemplo n.º 5
0
void GaduTokenSocketNotifiers::socketEvent()
{
	kdebugf();

	if (gg_token_watch_fd(H) == -1)
	{
		kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "getting token error\n");
		finished(QString(), QPixmap());
		return;
	}

	struct gg_pubdir *p = (struct gg_pubdir *)H->data;

	switch (H->state)
	{

		case GG_STATE_CONNECTING:
			kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "changing QSocketNotifiers.\n");
			watchFor(H);
			break;

		case GG_STATE_ERROR:
			kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "getting token error\n");
			finished(QString(), QPixmap());
			break;

		case GG_STATE_DONE:
			if (p->success)
			{
				kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "success\n");

				struct gg_token *t = (struct gg_token *)H->data;
				QString tokenId = QString::fromUtf8(t->tokenid);

				//nie optymalizowac!!!
				QByteArray buf(H->body_size, '0');
				for (unsigned int i = 0; i < H->body_size; ++i)
					buf[i] = H->body[i];

				QPixmap tokenImage;
				tokenImage.loadFromData(buf);

				finished(tokenId, tokenImage);
			}
			else
			{
				kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "getting token error\n");
				finished(QString(), QPixmap());
			}

			break;
	}

	kdebugf2();
}
Ejemplo n.º 6
0
DNSHandler::DNSHandler(const QString &marker, const QHostAddress &address)
	: marker(marker)
{
	kdebugf();
//	kdebugm(KDEBUG_WARNING, ">>>>>>>>>>%s\n", qPrintable(marker));

	if (address == QHostAddress())
		kdebugmf(KDEBUG_WARNING, "NULL ip address!\n");

	QHostInfo::lookupHost(address.toString(), this, SLOT(resultsReady(QHostInfo)));
	++counter;

	kdebugmf(KDEBUG_FUNCTION_END, "counter = %d\n", counter);
}
Ejemplo n.º 7
0
void ExternalPlayer::playSound(const QString &path, bool volumeControl, double volume)
{
	kdebugf();

	QString playerCommand = config_file.readEntry("Sounds", "SoundPlayer");
	QString volumeArguments;

	if (playerCommand.isEmpty())
	{
		kdebugmf(KDEBUG_FUNCTION_END, "end: player path is empty\n");
		return;
	}

	QStringList argumentList;

	if (volumeControl)
	{
		argumentList.append("-v");
		argumentList.append(QString::number(volume, 'g', 2));
	}

	argumentList.append(path);

	QProcess process;
	process.start(playerCommand, argumentList);
	process.waitForFinished();
}
Ejemplo n.º 8
0
void PCSpeaker::notify(Notification *notification) {
	kdebugf();
	notification->acquire();
	
	QString linia;
	if (notification->type().compare("NewChat") == 0) {
		linia = config_file.readEntry("PC Speaker", "OnChatPlayString");
	}
	else if (notification->type().compare("NewMessage") == 0) {
		linia = config_file.readEntry("PC Speaker", "OnMessagePlayString");
	}
	else if (notification->type().compare("ConnectionError") == 0) {
		linia = config_file.readEntry("PC Speaker", "OnConnectionErrorPlayString");
	}
	else if (notification->type().contains("StatusChanged", true)) {
		linia = config_file.readEntry("PC Speaker", "OnNotifyPlayString");
	}
	else {
		linia = config_file.readEntry("PC Speaker", "OnOtherMessagePlayString");
	}

	if (linia.length() > 0)
		parseAndPlay(linia);
	else
	    kdebugmf(KDEBUG_ERROR, "\n\nMelody String is empty!\n");

	notification->release();
	kdebugf2();
}
Ejemplo n.º 9
0
void TlenPersonalInfoWidget::personalInfoAvailable(Buddy buddy)
{
	kdebugmf (KDEBUG_INFO,"personal info available");
	NickName->setText(buddy.nickName());
	FirstName->setText(buddy.firstName());
	LastName->setText(buddy.lastName());
	Sex->setCurrentIndex((int)buddy.gender());
	BirthYear->setText(QString::number(buddy.birthYear()));
	City->setText(buddy.city());
	EMail->setText(buddy.email());

	// TODO 0.6.6: dangerous - no details means not this account?
	FetchOk = false;

	// always one contact
	Contact contact = buddy.contacts()[0];
	if (contact.isNull())
		return;

	TlenContactDetails *tlenDetails = dynamic_cast<TlenContactDetails *>(contact.details());
	if (!tlenDetails)
		return;

	LookingFor->setCurrentIndex((int) tlenDetails->lookingFor());
	Job->setCurrentIndex((int) tlenDetails->job());
	TodayPlans->setCurrentIndex((int) tlenDetails->todayPlans());

	ShowStatus->setChecked(tlenDetails->showStatus());
	HaveMic->setChecked(tlenDetails->haveMic());
	HaveCam->setChecked(tlenDetails->haveCam());
	FetchOk = true;
}
Ejemplo n.º 10
0
void GaduRosterService::exportContactList()
{
	if (!m_connection || !m_connection.data()->hasSession())
	{
		putFinished(false);
		return;
	}

	m_synchronizingContacts = contacts();
	for (auto &&contact : m_synchronizingContacts)
		contact.rosterEntry()->setSynchronizingToRemote();

	auto contacts = m_gaduListHelper->contactListToByteArray(m_synchronizingContacts);

	kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "\n%s\n", contacts.constData());

	auto accountData = GaduAccountData{account()};
	auto writableSessionToken = m_connection.data()->writableSessionToken();
	auto ret = gg_userlist100_request(writableSessionToken.rawSession(),
			GG_USERLIST100_PUT, accountData.userlistVersion(), GG_USERLIST100_FORMAT_TYPE_GG70, contacts.constData());
	if (-1 == ret)
	{
		markSynchronizingAsSynchronized();
		putFinished(false);
	}
}
Ejemplo n.º 11
0
void Updates::gotUpdatesInfo(const QHttpResponseHeader &responseHeader)
{
    Q_UNUSED(responseHeader)

    kdebugf();

    QByteArray data = HttpClient->readAll();

    if (config_file.readBoolEntry("General", "CheckUpdates"))
    {
        unsigned int size = data.size();
        if (size > 31)
        {
            kdebugmf(KDEBUG_WARNING, "cannot obtain update info\n");
            deleteLater();
            return;
        }

        QString newestVersion(data);
        if (isNewerVersion(newestVersion))
        {
            UpdatesDialog *dialog = new UpdatesDialog(newestVersion, Core::instance()->kaduWindow());
            dialog->show();
        }
    }

    config_file.writeEntry("General", "LastUpdateCheck", QDateTime(QDate(1970, 1, 1)).secsTo(QDateTime::currentDateTime()));

    deleteLater();
}
Ejemplo n.º 12
0
void GaduSearchService::handleEventPubdir50SearchReply(struct gg_event *e)
{
	gg_pubdir50_t res = e->event.pubdir50;

	ContactList results;

	int count = gg_pubdir50_count(res);
	kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "found %d results\n", count);

	for (int i = 0; i < count; i++)
	{
		Contact result;

		GaduContactAccountData *gcad = new GaduContactAccountData(result, Protocol->account(),
				gg_pubdir50_get(res, i, GG_PUBDIR50_UIN));

		result.addAccountData(gcad);
		result.setFirstName(cp2unicode(gg_pubdir50_get(res, i, GG_PUBDIR50_FIRSTNAME)));
		result.setLastName(cp2unicode(gg_pubdir50_get(res, i, GG_PUBDIR50_LASTNAME)));
		result.setNickName(cp2unicode(gg_pubdir50_get(res, i, GG_PUBDIR50_NICKNAME)));
		result.setBirthYear(QString::fromAscii(gg_pubdir50_get(res, i, GG_PUBDIR50_BIRTHYEAR)).toUShort());
		result.setCity(cp2unicode(gg_pubdir50_get(res, i, GG_PUBDIR50_CITY)));
		result.setFamilyName(cp2unicode(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYNAME)));
		result.setFamilyCity(cp2unicode(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYCITY)));
		result.setGender((ContactData::ContactGender)QString::fromAscii(gg_pubdir50_get(res, i, GG_PUBDIR50_GENDER)).toUShort());
		// TODO: 0.6.6
		// result.setStatus(gg_pubdir50_get(res, 0, GG_PUBDIR50_STATUS));

		results.append(result);
	}

	From = gg_pubdir50_next(res);

	emit newResults(results);
}
Ejemplo n.º 13
0
void GaduRosterService::handleEventUserlist100Version(gg_event *e)
{
	kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "new version of userlist available: %d\n", e->event.userlist100_version.version);

	auto accountData = GaduAccountData{account()};
	if (accountData.userlistVersion() != (int)e->event.userlist100_version.version)
		emit stateMachineRemoteDirty();
}
Ejemplo n.º 14
0
void GaduContactListService::exportContactList(ContactList contacts)
{
	QString contactsString = GaduListHelper::contactListToString(Protocol->account(), contacts);

	kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "\n%s\n", unicode2cp(contactsString).data());

	if (-1 == gg_userlist_request(Protocol->gaduSession(), GG_USERLIST_PUT, unicode2cp(contactsString)))
		emit contactListExported(false);
}
Ejemplo n.º 15
0
	int getHistoryEntriesCount(const QString &path, const UinsList &uins)
	{
		kdebugf();

		int lines = 0;
		QString filename = getFileNameByUinsList(uins);
		QByteArray buffer;
		QFile fidx(path + filename + ".idx"), f(path + filename);

		if (fidx.open(QIODevice::ReadOnly))
		{
			int offs, lastOffs = 0;
			lines = fidx.size() / sizeof(int);

			// ignore garbage in index file (strange, but sometimes happens)
			while (fidx.read((char *)&offs, sizeof(int)) > 0)
			{
				if (offs < lastOffs)
					--lines;
				else
					lastOffs = offs;
			}
		}
		// apparentyly sms doesn't have an index file, so handle this
		else if (filename == "sms" && f.open(QIODevice::ReadOnly))
		{
			QTextStream stream(&f);
			while (!stream.readLine().isNull())
				lines++;
			f.close();
		}
		else
		{
			kdebugmf(KDEBUG_ERROR, "Error opening history file %s\n", qPrintable(filename));
			kdebugf2();
			return 0;
		}

		fidx.close();

		kdebugmf(KDEBUG_INFO, "%d lines\n", lines);
		kdebugf2();
		return lines;
	}
Ejemplo n.º 16
0
void GaduSocketNotifiers::watchFor(int socket)
{
	kdebugmf(KDEBUG_NETWORK | KDEBUG_INFO, "notifier: %p, old socket: %d, socket: %d\n", this, Socket, socket);

	if (Socket == socket)
		return;

	Socket = socket;
	createSocketNotifiers();
}
Ejemplo n.º 17
0
void GaduContactListService::handleEventUserlistGetReply(struct gg_event *e)
{
	char *content = e->event.userlist.reply;
	if (!content)
	{
		kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "error!\n");

		emit contactListImported(false, ContactList());
		return;
	}

	if (content[0] != 0)
		ImportReply += cp2unicode(content);

	if (e->event.userlist.type == GG_USERLIST_GET_MORE_REPLY)
	{
		kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "next portion\n");
		return;
	}

	kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "\n%s\n", unicode2latin(ImportReply).data());

	emit contactListImported(true, GaduListHelper::stringToContactList(Protocol->account(), ImportReply));
}
Ejemplo n.º 18
0
void FileTransferManager::toggleFileTransferWindow(QAction *sender, bool toggled)
{
	kdebugmf(KDEBUG_FUNCTION_START, "start: fileTransferWindow:%p\n", fileTransferWindow);
	if (fileTransferWindow)
	{
		disconnect(this, SIGNAL(newFileTransfer(FileTransfer *)),
			fileTransferWindow, SLOT(newFileTransfer(FileTransfer *)));
		disconnect(this, SIGNAL(fileTransferDestroying(FileTransfer *)),
			fileTransferWindow, SLOT(fileTransferDestroying(FileTransfer *)));
		disconnect(fileTransferWindow, SIGNAL(destroyed()), this, SLOT(fileTransferWindowDestroyed()));
		delete fileTransferWindow;
		fileTransferWindow = 0;
	}
	else
	{
Ejemplo n.º 19
0
bool Parser::registerObjectTag(const QString &name, ObjectTagCallback func)
{
    kdebugf();
    if (registeredObjectTags.contains(name))
    {
        kdebugmf(KDEBUG_ERROR | KDEBUG_FUNCTION_END, "tag %s already registered!\n", qPrintable(name));
        return false;
    }
    else
    {
        registeredObjectTags.insert(name, func);
        kdebugf2();
        return true;
    }
}
Ejemplo n.º 20
0
void GaduRosterService::handleEventUserlist100Reply(struct gg_event *e)
{
	switch (e->event.userlist100_reply.type)
	{
		case GG_USERLIST100_REPLY_LIST:
			handleEventUserlist100GetReply(e);
			break;
		case GG_USERLIST100_REPLY_ACK:
		case GG_USERLIST100_REPLY_REJECT:
			handleEventUserlist100PutReply(e);
			break;
		default:
			kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "got unknown userlist100 reply type (%d)\n", e->event.userlist100_reply.type);
	}
}
Ejemplo n.º 21
0
void DccSocketNotifiers::watchFor(struct gg_dcc *socket)
{
	kdebugmf(KDEBUG_NETWORK | KDEBUG_INFO, "%p\n", socket);

	Version = Dcc6;
	Socket = socket;
	Socket7 = 0;

	if (Socket)
	{
		DccCheckField = &Socket->check;
		GaduSocketNotifiers::watchFor(Socket->fd);
	}
	else
		GaduSocketNotifiers::watchFor(0);
}
Ejemplo n.º 22
0
void GaduSearchService::handleEventPubdir50SearchReply(struct gg_event *e)
{
	gg_pubdir50_t res = e->event.pubdir50;

	BuddyList results;

	int count = gg_pubdir50_count(res);
	kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "found %d results\n", count);

	for (int i = 0; i < count; i++)
		results.append(GaduProtocolHelper::searchResultToBuddy(account(), res, i));

	From = gg_pubdir50_next(res);

	emit newResults(results);
}
Ejemplo n.º 23
0
bool Parser::unregisterTag(const QString &name, BuddyOrContactTagCallback func)
{
    Q_UNUSED(func)

    kdebugf();
    if (!registeredTags.contains(name))
    {
        kdebugmf(KDEBUG_ERROR | KDEBUG_FUNCTION_END, "tag %s not registered!\n", qPrintable(name));
        return false;
    }
    else
    {
        registeredTags.remove(name);
        kdebugf2();
        return true;
    }
}
Ejemplo n.º 24
0
void GaduChatImageService::prepareImageToSend(const QString &imageFileName, uint32_t &size, uint32_t &crc32)
{
	kdebugmf(KDEBUG_INFO, "Using file \"%s\"\n", qPrintable(imageFileName));

	ImageToSend imageToSend;
	imageToSend.fileName = imageFileName;
	loadImageContent(imageToSend);

	if (imageToSend.content.isNull())
		return;

	imageToSend.crc32 = gg_crc32(0, (const unsigned char*)imageToSend.content.data(), imageToSend.content.length());

	size = imageToSend.content.length();
	crc32 = imageToSend.crc32;

	ImagesToSend[qMakePair(size, crc32)] = imageToSend;
}
Ejemplo n.º 25
0
int OSSPlayerSlots::read_all(int fd, char *buffer, int count)
{
	kdebugf();
	int offset = 0,c;
	while (offset<count)
	{
		c = read(fd, buffer + offset, count - offset);
		if (c == -1)
		{
			kdebugmf(KDEBUG_WARNING, "%s (%d)\n", strerror(errno), errno);
			return -1;
		}
//		else
//			kdebugm(KDEBUG_INFO, "read: %d\n", c);
		offset += c;
	}
	return offset;
}
Ejemplo n.º 26
0
void GaduRosterService::handleEventUserlist100PutReply(struct gg_event *e)
{
	if (!m_stateMachine->isPerformingPut())
	{
		kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "got unexpected userlist 100 put reply, ignoring\n");
		return;
	}

	if (e->event.userlist100_reply.type == GG_USERLIST100_REPLY_ACK)
	{
		auto accountData = GaduAccountData{account()};
		accountData.setUserlistVersion(e->event.userlist100_reply.version);
		markSynchronizingAsSynchronized();
		putFinished(true);
		return;
	}

	putFinished(false);
}
Ejemplo n.º 27
0
int OSSPlayerSlots::write_all(int fd, const char *data, int length, int chunksize)
{
	int res = 0, written = 0;

	while (written < length) {
		int towrite = (chunksize < length - written) ? chunksize : length - written;
		res = write(fd, data + written, towrite);
		if (res == -1) {
			kdebugmf(KDEBUG_WARNING, "%s (%d)\n", strerror(errno), errno);
			if (errno == EAGAIN)
				continue;
			else
				break;
		} else {
			written += towrite;
			res = written;
		}
	}
	return res;
}
Ejemplo n.º 28
0
QByteArray AmarokMediaPlayer::executeCommand(QString obj, QString func)
{
	QByteArray result;
	QStringList params;
	QProcess process;

	params << "amarok" << obj << func;
	process.start("dcop", params);

	if (!process.waitForStarted(500))
		return result;

	if (!process.waitForFinished())
		return result;

	result = process.readAll();

	kdebugmf(KDEBUG_INFO, "command: dcop amarok %s %s - result: [%s]\n",
		qPrintable(obj), qPrintable(func), qPrintable(QString(result)));

	return result;
}
Ejemplo n.º 29
0
QByteArray ITunesMediaPlayer::executeCommand(const QString &command)
{
	QByteArray result;
	QStringList params;
	QProcess process;

	params << "-e" << '\'' + command + '\'';
	process.start("osascript", params);

	if (!process.waitForStarted(500))
		return result;

	if (!process.waitForFinished())
		return result;

	result = process.readAll();

	kdebugmf(KDEBUG_INFO,"command: osascript -e %s - result: [%s]\n",
		qPrintable(command), qPrintable(QString(result)));

	return result;
}
Ejemplo n.º 30
0
void DccSocketNotifiers::watchFor(struct gg_dcc7 *socket)
{
	kdebugmf(KDEBUG_NETWORK | KDEBUG_INFO, "%p\n", socket);

	Version = Dcc7;
	Socket = 0;
	Socket7 = socket;

	if (Socket7)
	{
		DccCheckField = &Socket7->check;

		if (-1 == Socket7->fd) // wait for accept/reject
		{
			connect(Protocol->socketNotifiers(), SIGNAL(dcc7Accepted(struct gg_dcc7 *)), 
					this, SLOT(dcc7Accepted(struct gg_dcc7 *)));
			connect(Protocol->socketNotifiers(), SIGNAL(dcc7Rejected(struct gg_dcc7 *)),
					this, SLOT(dcc7Rejected(struct gg_dcc7 *)));
			return;
		}

		GaduSocketNotifiers::watchFor(Socket7->fd);
	}