本文整理汇总了C++中QXmppPresence::setAvailableStatusType方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmppPresence::setAvailableStatusType方法的具体用法?C++ QXmppPresence::setAvailableStatusType怎么用?C++ QXmppPresence::setAvailableStatusType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmppPresence
的用法示例。
在下文中一共展示了QXmppPresence::setAvailableStatusType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setStatus
void MyXmppClient::setStatus( StatusXmpp __status) {
if (__status != m_status || xmppClient->state() == QXmppClient::ConnectingState) {
QXmppPresence myPresence = xmppClient->clientPresence();
if (__status != Offline) {
if( xmppClient->state() == QXmppClient::DisconnectedState )
this->connectToXmppServer();
myPresence.setType( QXmppPresence::Available );
} else {
if( (xmppClient->state() != QXmppClient::DisconnectedState) )
xmppClient->disconnectFromServer();
myPresence.setType( QXmppPresence::Unavailable );
}
switch (__status) {
case Online:
myPresence.setAvailableStatusType( QXmppPresence::Online );
break;
case Chat:
myPresence.setAvailableStatusType( QXmppPresence::Chat );
break;
case Away:
myPresence.setAvailableStatusType( QXmppPresence::Away );
break;
case XA:
myPresence.setAvailableStatusType( QXmppPresence::XA );
break;
case DND:
myPresence.setAvailableStatusType( QXmppPresence::DND );
break;
case Offline:
m_status = __status;
this->clearPresence();
break;
default: break;
}
xmppClient->setClientPresence( myPresence );
this->presenceReceived( myPresence );
}
}
示例2: StatusToPresence
QXmppPresence StatusToPresence (State state, const QString& text, int prio)
{
QXmppPresence::Type presType = state == SOffline ?
QXmppPresence::Unavailable :
QXmppPresence::Available;
QXmppPresence pres (presType);
if (state != SOffline)
pres.setAvailableStatusType (static_cast<QXmppPresence::AvailableStatusType> (state - 1));
pres.setStatusText (text);
pres.setPriority (prio);
return pres;
}
示例3: setStatusType
void ChatClient::setStatusType(const QString &statusType)
{
if (statusType != this->statusType()) {
QXmppPresence presence = clientPresence();
if (statusType == "offline") {
presence.setType(QXmppPresence::Unavailable);
} else {
presence.setType(QXmppPresence::Available);
presence.setAvailableStatusType(stringToStatus(statusType));
}
setClientPresence(presence);
emit statusTypeChanged(statusType);
}
}
示例4: executeCommand
bool XMPPPresenceCommand::executeCommand(QStringList * const arguments)
{
bool ret = false;
if (arguments->length() < 4)
{
this->client->write(tr("ERROR: xmppPresence <resource> <priority> <status> <message>")
+ "\r\n");
}
else
{
QXmppClient * const client =
XMPPResourceStore::instance()->getFromStore(arguments->first());
arguments->removeFirst();
if (client)
{
bool intOk = false;
const int priority = arguments->first().toInt(&intOk);
arguments->removeFirst();
if (not intOk)
{
this->client->write(tr("ERROR: Priority must be an integer") + "\r\n");
}
else
{
QXmppPresence presence;
presence.setPriority(priority);
const QString type = arguments->first();
arguments->removeFirst();
bool sOk = true;
presence.setType(QXmppPresence::Available);
if (type == "online")
{
presence.setAvailableStatusType(QXmppPresence::Online);
}
else if (type == "away")
{
presence.setAvailableStatusType(QXmppPresence::Away);
}
else if (type == "xa")
{
presence.setAvailableStatusType(QXmppPresence::XA);
}
else if (type == "dnd")
{
presence.setAvailableStatusType(QXmppPresence::DND);
}
else if (type == "chat")
{
presence.setAvailableStatusType(QXmppPresence::Chat);
}
else if (type == "invisible")
{
presence.setAvailableStatusType(QXmppPresence::Invisible);
}
else
{
sOk = false;
this->client->write(tr("ERROR: Unknown presence status type") + "\r\n");
}
if (sOk)
{
const QString message = arguments->join(" ");
presence.setStatusText(message);
if (XMPPDebugCommand::isDebugEnabled())
{
XMPPPrintCommand::printMessage(
true,
&presence);
}
ret = client->sendPacket(presence);
if (not ret)
{
this->client->write(tr("ERROR: Failed to send packet") + "\r\n");
}
else
{
XMPPResourceStore::instance()->setLastMessageSent(
client,
presence);
}
}
}
}
else
{
this->client->write(tr("ERROR: Unknown resource") + "\r\n");
}
}
return ret;
}