本文整理汇总了C++中Contact::currentStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ Contact::currentStatus方法的具体用法?C++ Contact::currentStatus怎么用?C++ Contact::currentStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::currentStatus方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getStatusIconPath
static QString getStatusIconPath(BuddyOrContact buddyOrContact)
{
Buddy buddy = buddyOrContact.buddy();
Contact contact = buddyOrContact.contact();
if (buddy.isBlocked())
return webKitPath(IconsManager::instance()->iconPath("kadu_icons", "16x16", "blocked"));
if (contact.isBlocking())
return webKitPath(IconsManager::instance()->iconPath("kadu_icons", "16x16", "blocking"));
if (contact.contactAccount())
{
Protocol *protocol = contact.contactAccount().protocolHandler();
if (protocol)
{
StatusTypeManager* statustypemanager = StatusTypeManager::instance();
if (statustypemanager)
{
Status status = contact.currentStatus();
QString iconpath = statustypemanager->statusIconFullPath(protocol->statusPixmapPath(), status.type(), !status.description().isEmpty(), false);
if (!iconpath.isEmpty())
return webKitPath(iconpath);
}
}
}
return QString();
}
示例2: greyOut
bool AvatarPainter::greyOut()
{
if (!Configuration->avatarGreyOut())
return false;
Contact contact = Index.data(ContactRole).value<Contact>();
return contact.currentStatus().isDisconnected();
}
示例3: sendState
void JabberChatStateService::sendState(const Contact &contact, ChatState state)
{
if (!m_client || !m_client->isConnected())
return;
if (!contact || contact.currentStatus().isDisconnected())
return;
auto receivedChatState = static_cast<QXmppMessage::State>(contact.property("jabber:received-chat-state", QXmppMessage::State::None).toInt());
if (receivedChatState == QXmppMessage::State::None || receivedChatState == QXmppMessage::State::Gone)
return;
auto jabberAccountDetails = dynamic_cast<JabberAccountDetails *>(account().details());
if (!jabberAccountDetails || !jabberAccountDetails->sendTypingNotification())
return;
auto xmppState = stateToXmppState(state);
if (!jabberAccountDetails->sendGoneNotification() && (xmppState == QXmppMessage::State::Gone || xmppState == QXmppMessage::State::Inactive))
xmppState = QXmppMessage::State::Paused;
auto sentChatState = static_cast<QXmppMessage::State>(contact.property("jabber:sent-chat-state", QXmppMessage::State::None).toInt());
// invalid transition
if (sentChatState == QXmppMessage::State::None && (xmppState != QXmppMessage::State::Active && xmppState != QXmppMessage::State::Composing && xmppState != QXmppMessage::State::Gone))
return;
// don't send if it is the same as last sent state
if (xmppState == sentChatState || xmppState == QXmppMessage::State::None)
return;
auto jid = m_resourceService->bestContactJid(contact);
auto xmppMessage = QXmppMessage{};
xmppMessage.setFrom(m_client.data()->clientPresence().id());
xmppMessage.setStamp(QDateTime::currentDateTime());
xmppMessage.setTo(jid.full());
xmppMessage.setType(QXmppMessage::Chat);
if (xmppState == QXmppMessage::State::Inactive && sentChatState == QXmppMessage::State::Composing)
{
// send intermediate state first
xmppMessage.setState(QXmppMessage::State::Paused);
m_client->sendPacket(xmppMessage);
}
if (xmppState == QXmppMessage::State::Composing && sentChatState == QXmppMessage::State::Inactive)
{
// send intermediate state first
xmppMessage.setState(QXmppMessage::State::Active);
m_client->sendPacket(xmppMessage);
}
xmppMessage.setState(xmppState);
m_client->sendPacket(xmppMessage);
// Save last state
// if (sentChatState != QXmppMessage::State::Gone || xmppState == QXmppMessage::State::Active) I don't know why we have this condition
contact.addProperty("jabber:sent-chat-state", static_cast<int>(xmppState), CustomProperties::NonStorable);
}
示例4: filterContact
TalkableFilter::FilterResult HideOfflineWithoutDescriptionTalkableFilter::filterContact(const Contact &contact)
{
if (!m_enabled)
return Undecided;
auto const &status = contact.currentStatus();
if (status.isDisconnected() && status.description().isEmpty())
return Rejected;
else
return Undecided;
}
示例5: acceptBuddy
bool OnlineAndDescriptionBuddyFilter::acceptBuddy(const Buddy &buddy)
{
if (!Enabled)
return true;
Contact preferredContact = BuddyPreferredManager::instance()->preferredContact(buddy, false);
if (preferredContact.isNull())
return false;
Status status = preferredContact.currentStatus();
return !status.isDisconnected() || !status.description().isEmpty();
}
示例6: checkChat
bool Firewall::checkChat(const Chat &chat, const Contact &sender, const QString &message, bool &ignore)
{
kdebugf();
if (!CheckChats)
return false;
// konferencja
if (chat.contacts().count() > 1)
{
kdebugf2();
return false;
}
if (!sender.ownerBuddy().isAnonymous() || Passed.contains(sender))
{
kdebugf2();
return false;
}
if (chat.chatAccount().statusContainer()->status().type() == "Invisible" && DropAnonymousWhenInvisible)
{
writeLog(sender, tr("Chat with anonim silently dropped.\n") + "----------------------------------------------------\n");
kdebugf2();
return true;
}
if (IgnoreInvisible)
{
if (sender.currentStatus().isDisconnected())
{
QDateTime *dateTime = chat.chatAccount().data()->moduleData<QDateTime>("firewall-account-connected");
if (dateTime && (*dateTime < QDateTime::currentDateTime()))
{
Protocol *protocol = chat.chatAccount().protocolHandler();
if (!protocol)
{
kdebugf2();
return false;
}
ChatService *chatService = protocol->chatService();
if (!chatService)
{
kdebugf2();
return false;
}
chatService->sendMessage(chat, tr("This message has been generated AUTOMATICALLY!\n\nI'm a busy person and I don't have time for stupid chats with the persons hiding itself. If you want to talk with me change the status to Online or Busy first."), true);
}
writeLog(sender, tr("Chat with invisible anonim ignored.\n") + "----------------------------------------------------\n");
kdebugf2();
return true;
}
}
if (pattern.exactMatch(message.simplified()))
{
Passed.insert(sender);
if (Confirmation)
{
Protocol *protocol = chat.chatAccount().protocolHandler();
if (!protocol)
{
kdebugf2();
return false;
}
ChatService *chatService = protocol->chatService();
if (!chatService)
{
kdebugf2();
return false;
}
chatService->sendMessage(chat, ConfirmationText, true);
}
writeLog(sender, tr("User wrote right answer!\n") + "----------------------------------------------------\n");
ignore = true;
kdebugf2();
return false;
}
else
{
if (LastContact != sender && Search)
{
SearchWindow *sd = new SearchWindow(Core::instance()->kaduWindow(), sender.ownerBuddy());
sd->show();
sd->firstSearch();
LastContact = sender;
}
//.........这里部分代码省略.........
示例7: parse
QString Parser::parse(const QString &s, BuddyOrContact buddyOrContact, const QObject * const object, bool escape)
{
Buddy buddy = buddyOrContact.buddy();
Contact contact = buddyOrContact.contact();
kdebugmf(KDEBUG_DUMP, "%s escape=%i\n", qPrintable(s), escape);
int index = 0, i, len = s.length();
QList<ParserToken> parseStack;
static QHash<QChar, bool> searchChars;
if (!searchChars.value('%', false))
{
searchChars['%'] = true;
searchChars['['] = true;
searchChars['{'] = true;
searchChars['\\'] = true;
searchChars['$'] = true;
searchChars['@'] = true;
searchChars['#'] = true;
searchChars['}'] = true;
searchChars[']'] = true;
}
bool allowExec = config_file.readBoolEntry("General", "AllowExecutingFromParser", false);
searchChars['`'] = allowExec;
searchChars['\''] = allowExec;
while (index < len)
{
ParserToken pe1, pe;
for(i = index; i < len; ++i)
if (searchChars.value(s.at(i), false))
break;
// this is the same, but code above is muuuuch faster
// i=s.find(QRegExp("%|`|\\{|\\[|'|\\}|\\]"), index);
if (i != index)
{
pe1.type = ParserToken::PT_STRING;
pe1.content = s.mid(index, i - index);
parseStack.push_back(pe1);
if (i == len)
break;
}
char c = s.at(i).toAscii();
if (c == '%')
{
++i;
if (i == len)
break;
pe.type = ParserToken::PT_STRING;
switch (s.at(i).toAscii())
{
case 's':
++i;
if (contact)
{
StatusType *type = StatusTypeManager::instance()->statusType(contact.currentStatus().type());
if (type)
pe.content = type->displayName();
}
break; // TODO: 't' removed
case 'q':
++i;
if (contact)
{
StatusContainer *container = contact.contactAccount().statusContainer();
if (container)
pe.content = container->statusIconPath(contact.currentStatus().type());
}
break;
case 'd':
++i;
if (contact)
pe.content = contact.currentStatus().description();
if (escape)
HtmlDocument::escapeText(pe.content);
if (config_file.readBoolEntry("Look", "ShowMultilineDesc"))
{
pe.content.replace('\n', QLatin1String("<br/>"));
pe.content.replace(QRegExp("\\s\\s"), QString(" "));
}
break;
case 'i':
++i;
if (contact)
pe.content = contact.address().toString();
break;
case 'v':
++i;
if (contact)
pe.content = contact.dnsName();
break;
//.........这里部分代码省略.........