本文整理汇总了C++中StatusMessage::setStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ StatusMessage::setStatus方法的具体用法?C++ StatusMessage::setStatus怎么用?C++ StatusMessage::setStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StatusMessage
的用法示例。
在下文中一共展示了StatusMessage::setStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
bool SnacIcqBuddy::process(unsigned short subtype, ICQBuffer* buf, unsigned short seq)
{
switch (subtype)
{
case ICQ_SNACxBDY_RIGHTSxGRANTED:
log(L_DEBUG, "Buddy rights granted");
break;
case ICQ_SNACxBDY_USEROFFLINE:
{
Contact *contact;
QString screen = buf->unpackScreen();
log(L_DEBUG, "Buddy offline: %s", qPrintable(screen));
ICQUserData *data = m_client->findContact(screen, NULL, false, contact);
if(!data)
break;
if(data->getStatus() != ICQ_STATUS_OFFLINE)
{
m_client->setOffline(data);
StatusMessage *m = new StatusMessage;
m->setContact(contact->id());
m->setClient(m_client->dataName(data));
m->setStatus(STATUS_OFFLINE);
m->setFlags(MESSAGE_RECEIVED);
EventMessageReceived e(m);
if(!e.process())
delete m;
}
else
{
// hack for trillian
EventContact e(contact, EventContact::eOnline);
e.process();
}
break;
}
case ICQ_SNACxBDY_USERONLINE:
{
Contact *contact;
QString screen = buf->unpackScreen();
log(L_DEBUG, "Buddy online: %s", qPrintable(screen));
ICQUserData *data = m_client->findContact(screen, NULL, false, contact);
if(data)
{
bool bChanged = false;
bool bAwayChanged = false;
unsigned long prevStatus = data->getStatus();
unsigned short level, len;
(*buf) >> level >> len;
data->setWarningLevel(level);
TlvList tlv((*buf));
Tlv* tlvClass = tlv(TLV_USER_CLASS);
if(tlvClass)
{
unsigned short userClass = *tlvClass;
if(userClass != data->getClass())
{
if ((userClass & CLASS_AWAY) != (data->getClass() & CLASS_AWAY))
{
data->setStatusTime((unsigned long)time(NULL));
bAwayChanged = true;
}
data->setClass(userClass);
bChanged = true;
}
if(data->getUin() == 0)
{
if (userClass & CLASS_AWAY)
{
m_client->fetchAwayMessage(data);
}
else
{
data->setAutoReply(QString::null);
}
}
}
// Status TLV
Tlv *tlvStatus = tlv(TLV_USER_STATUS);
if(tlvStatus)
{
uint32_t status = *tlvStatus;
if (status != data->getStatus())
{
data->setStatus(status);
if ((status & 0xFF) == 0)
data->setAutoReply(QString::null);
data->setStatusTime((unsigned long)time(NULL));
}
}
else if(data->getStatus() == ICQ_STATUS_OFFLINE)
{
data->setStatus(ICQ_STATUS_ONLINE);
data->setStatusTime((unsigned long)time(NULL));
}
// Online time TLV
Tlv *tlvOnlineTime = tlv(TLV_USER_SIGNON_TIME);
//.........这里部分代码省略.........