本文整理汇总了C++中QXmppByteStreamIq::setType方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmppByteStreamIq::setType方法的具体用法?C++ QXmppByteStreamIq::setType怎么用?C++ QXmppByteStreamIq::setType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmppByteStreamIq
的用法示例。
在下文中一共展示了QXmppByteStreamIq::setType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _q_candidateReady
void QXmppTransferIncomingJob::_q_candidateReady()
{
bool check;
Q_UNUSED(check);
if (!m_candidateClient)
return;
info(QString("Connected to streamhost: %1 (%2 %3)").arg(
m_candidateHost.jid(),
m_candidateHost.host(),
QString::number(m_candidateHost.port())));
setState(QXmppTransferJob::TransferState);
d->socksSocket = m_candidateClient;
m_candidateClient = 0;
m_candidateTimer->deleteLater();
m_candidateTimer = 0;
check = connect(d->socksSocket, SIGNAL(readyRead()),
this, SLOT(_q_receiveData()));
Q_ASSERT(check);
check = connect(d->socksSocket, SIGNAL(disconnected()),
this, SLOT(_q_disconnected()));
Q_ASSERT(check);
QXmppByteStreamIq ackIq;
ackIq.setId(m_streamOfferId);
ackIq.setTo(m_streamOfferFrom);
ackIq.setType(QXmppIq::Result);
ackIq.setSid(d->sid);
ackIq.setStreamHostUsed(m_candidateHost.jid());
d->client->sendPacket(ackIq);
}
示例2: _q_candidateReady
void QXmppTransferIncomingJob::_q_candidateReady()
{
bool check;
Q_UNUSED(check);
if (!m_candidateClient)
return;
setState(QXmppTransferJob::TransferState);
d->socksSocket = m_candidateClient;
m_candidateClient = 0;
check = connect(d->socksSocket, SIGNAL(readyRead()),
this, SLOT(_q_receiveData()));
Q_ASSERT(check);
check = connect(d->socksSocket, SIGNAL(disconnected()),
this, SLOT(_q_disconnected()));
Q_ASSERT(check);
QXmppByteStreamIq ackIq;
ackIq.setId(m_streamOfferId);
ackIq.setTo(m_streamOfferFrom);
ackIq.setType(QXmppIq::Result);
ackIq.setSid(d->sid);
ackIq.setStreamHostUsed(m_candidateHost.jid());
d->client->sendPacket(ackIq);
}
示例3: _q_proxyReady
void QXmppTransferOutgoingJob::_q_proxyReady()
{
// activate stream
QXmppByteStreamIq streamIq;
streamIq.setType(QXmppIq::Set);
streamIq.setFrom(d->client->configuration().jid());
streamIq.setTo(d->socksProxy.jid());
streamIq.setSid(d->sid);
streamIq.setActivate(d->jid);
d->requestId = streamIq.id();
d->client->sendPacket(streamIq);
}
示例4: connectToNextHost
void QXmppTransferIncomingJob::connectToNextHost()
{
bool check;
Q_UNUSED(check);
if (m_streamCandidates.isEmpty()) {
// could not connect to any stream host
QXmppByteStreamIq response;
response.setId(m_streamOfferId);
response.setTo(m_streamOfferFrom);
QXmppStanza::Error error(QXmppStanza::Error::Cancel, QXmppStanza::Error::ItemNotFound);
error.setCode(404);
response.setType(QXmppIq::Error);
response.setError(error);
d->client->sendPacket(response);
terminate(QXmppTransferJob::ProtocolError);
return;
}
// try next host
m_candidateHost = m_streamCandidates.takeFirst();
info(QString("Connecting to streamhost: %1 (%2 %3)").arg(
m_candidateHost.jid(),
m_candidateHost.host(),
QString::number(m_candidateHost.port())));
const QString hostName = streamHash(d->sid,
d->jid,
d->client->configuration().jid());
// try to connect to stream host
m_candidateClient = new QXmppSocksClient(m_candidateHost.host(), m_candidateHost.port(), this);
m_candidateTimer = new QTimer(this);
check = connect(m_candidateClient, SIGNAL(disconnected()),
this, SLOT(_q_candidateDisconnected()));
Q_ASSERT(check);
check = connect(m_candidateClient, SIGNAL(ready()),
this, SLOT(_q_candidateReady()));
Q_ASSERT(check);
check = connect(m_candidateTimer, SIGNAL(timeout()),
this, SLOT(_q_candidateDisconnected()));
Q_ASSERT(check);
m_candidateTimer->setSingleShot(true);
m_candidateTimer->start(socksTimeout);
m_candidateClient->connectToHost(hostName, 0);
}
示例5: if
bool XmppServerProxy65::handleStanza(const QDomElement &element)
{
if (element.attribute("to") != d->jid)
return false;
if (element.tagName() == "iq" && QXmppDiscoveryIq::isDiscoveryIq(element))
{
QXmppDiscoveryIq discoIq;
discoIq.parse(element);
if (discoIq.type() == QXmppIq::Get)
{
QXmppDiscoveryIq responseIq;
responseIq.setTo(discoIq.from());
responseIq.setFrom(discoIq.to());
responseIq.setId(discoIq.id());
responseIq.setType(QXmppIq::Result);
responseIq.setQueryType(discoIq.queryType());
if (discoIq.queryType() == QXmppDiscoveryIq::InfoQuery)
{
QStringList features = QStringList() << ns_disco_info << ns_disco_items << ns_bytestreams;
QList<QXmppDiscoveryIq::Identity> identities;
QXmppDiscoveryIq::Identity identity;
identity.setCategory("proxy");
identity.setType("bytestreams");
identity.setName("SOCKS5 Bytestreams");
identities.append(identity);
responseIq.setFeatures(features);
responseIq.setIdentities(identities);
}
server()->sendPacket(responseIq);
return true;
}
}
else if (element.tagName() == "iq" && QXmppByteStreamIq::isByteStreamIq(element))
{
QXmppByteStreamIq bsIq;
bsIq.parse(element);
if (bsIq.type() == QXmppIq::Get)
{
// request for the proxy's network address
if (d->allowedDomains.contains(QXmppUtils::jidToDomain(bsIq.from()))) {
QXmppByteStreamIq responseIq;
responseIq.setType(QXmppIq::Result);
responseIq.setTo(bsIq.from());
responseIq.setFrom(bsIq.to());
responseIq.setId(bsIq.id());
QList<QXmppByteStreamIq::StreamHost> streamHosts;
QXmppByteStreamIq::StreamHost streamHost;
streamHost.setJid(d->jid);
streamHost.setHost(d->hostAddress.toString());
streamHost.setPort(d->port);
streamHosts.append(streamHost);
responseIq.setStreamHosts(streamHosts);
server()->sendPacket(responseIq);
} else {
QXmppIq responseIq;
responseIq.setType(QXmppIq::Error);
responseIq.setTo(bsIq.from());
responseIq.setFrom(bsIq.to());
responseIq.setId(bsIq.id());
responseIq.setError(QXmppStanza::Error(QXmppStanza::Error::Auth, QXmppStanza::Error::Forbidden));
server()->sendPacket(responseIq);
}
}
else if (bsIq.type() == QXmppIq::Set)
{
QString hash = streamHash(bsIq.sid(), bsIq.from(), bsIq.activate());
QTcpSocketPair *pair = d->pairs.value(hash);
QXmppIq responseIq;
responseIq.setTo(bsIq.from());
responseIq.setFrom(bsIq.to());
responseIq.setId(bsIq.id());
if (pair &&
d->allowedDomains.contains(QXmppUtils::jidToDomain(bsIq.from())))
{
if (pair->activate()) {
info(QString("Activated connection %1 by %2").arg(hash, bsIq.from()));
responseIq.setType(QXmppIq::Result);
} else {
warning(QString("Failed to activate connection %1 by %2").arg(hash, bsIq.from()));
responseIq.setType(QXmppIq::Error);
}
} else {
warning(QString("Not activating connection %1 by %2").arg(hash, bsIq.from()));
responseIq.setType(QXmppIq::Error);
}
server()->sendPacket(responseIq);
}
return true;
//.........这里部分代码省略.........