本文整理汇总了C++中QXmppPresence::setPriority方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmppPresence::setPriority方法的具体用法?C++ QXmppPresence::setPriority怎么用?C++ QXmppPresence::setPriority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmppPresence
的用法示例。
在下文中一共展示了QXmppPresence::setPriority方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}