当前位置: 首页>>代码示例>>C++>>正文


C++ Protocol::chatService方法代码示例

本文整理汇总了C++中Protocol::chatService方法的典型用法代码示例。如果您正苦于以下问题:C++ Protocol::chatService方法的具体用法?C++ Protocol::chatService怎么用?C++ Protocol::chatService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Protocol的用法示例。


在下文中一共展示了Protocol::chatService方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: maxMessageSize

int OtrMessageService::maxMessageSize(const Account &account) const
{
	Protocol *protocolHandler = account.protocolHandler();
	if (!protocolHandler)
		return 0;
	ChatService *chatService = protocolHandler->chatService();
	if (!chatService)
		return 0;
	return chatService->maxMessageLength();
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例2: accountUnregistered

void Firewall::accountUnregistered(Account account)
{
    Protocol *protocol = account.protocolHandler();
    if (!protocol)
        return;

    ChatService *chatService = protocol->chatService();
    if (!chatService)
        return;

    disconnect(chatService, SIGNAL(filterIncomingMessage(Chat, Contact, QString &, time_t, bool &)),
               this, SLOT(filterIncomingMessage(Chat, Contact, QString &, time_t, bool &)));
    disconnect(chatService, SIGNAL(filterOutgoingMessage(Chat, QString &, bool &)),
               this, SLOT(filterOutgoingMessage(Chat, QString &, bool &)));
    disconnect(account, SIGNAL(connected()), this, SLOT(accountConnected()));
}
开发者ID:partition,项目名称:kadu,代码行数:16,代码来源:firewall.cpp

示例3: 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;
        }

//.........这里部分代码省略.........
开发者ID:partition,项目名称:kadu,代码行数:101,代码来源:firewall.cpp


注:本文中的Protocol::chatService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。