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


C++ EventMessage类代码示例

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


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

示例1: fill

bool AIMInfo::processEvent(Event *e)
{
    if (e->type() == eEventContact){
        EventContact *ec = static_cast<EventContact*>(e);
        if(ec->action() != EventContact::eChanged)
            return false;
        Contact *contact = ec->contact();
        if (contact->have(m_data))
            fill();
    } else
    if ((e->type() == eEventMessageReceived) && m_data){
        EventMessage *em = static_cast<EventMessage*>(e);
        Message *msg = em->msg();
        if (msg->type() == MessageStatus){
            if (m_client->dataName(m_data) == msg->client())
                fill();
        }
    } else
    if ((e->type() == eEventClientChanged) && (m_data == 0)){
        EventClientChanged *ecc = static_cast<EventClientChanged*>(e);
        if (ecc->client() == m_client)
            fill();
    }
    return false;
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:25,代码来源:aiminfo.cpp

示例2: HandleIOMessageFailure

void IOHandler::HandleIOMessageFailure(const EventMessage& message) {
  ProtocolMessage* protocol_message = message.GetProtocolMessage();
  if (protocol_message->direction == ProtocolMessage::kOutgoingRequest) {
    protocol_message->status = ProtocolMessage::kInternalFailure;
    if (!GetIOService()->GetServiceStage()->Send(protocol_message)) {
      MI_LOG_WARN(logger, "IOHandler::HandleIOMessageFailure send fail");
    }
  } else {
    message.Destroy();
  }
}
开发者ID:fanfeixiang,项目名称:minotaur,代码行数:11,代码来源:io_handler.cpp

示例3: ClientsRegistered

    size_t Client::ClientsRegistered(std::string eventType)
    {
        EventMessage msg;
        msg.setEventType(REGISTERED_MSG);
        msg.pushParam(eventType);

        this->Send(msg, PRIORITY_COMMAND);
        this->WaitForEvent(msg, REGISTERED_RESP);

        return (size_t)msg.getParamInt(0);
    }
开发者ID:Frizi,项目名称:cs-ipc,代码行数:11,代码来源:Client.cpp

示例4: IsClientConnected

    bool Client::IsClientConnected(std::string target)
    {
        EventMessage msg;
        msg.setEventType(ISCONNECTED_MSG);
        msg.pushParam(target);

        this->Send(msg, PRIORITY_COMMAND);
        this->WaitForEvent(msg, ISCONNECTED_RESP);

        return ( msg.getParamInt(0) != 0 );
    }
开发者ID:Frizi,项目名称:cs-ipc,代码行数:11,代码来源:Client.cpp

示例5: processEvent

bool DeclineDlg::processEvent(Event *e)
{
    if (e->type() == eEventMessageDeleted)
    {
        EventMessage *em = static_cast<EventMessage*>(e);
        Message *msg = em->msg();
        if (msg->id() == m_msg->id())
            close();
    }
    return false;
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:11,代码来源:declinedlg.cpp

示例6: EventMessage

Serializable*
EventMessage::deserialize(SerializedInstance* data) {
    unsigned int source = data->getUnsigned();
    unsigned int dest = data->getUnsigned();
    unsigned int incNum = data->getUnsigned();
    Event* event = dynamic_cast<Event*>(data->getSerializable());
    const string gvtInfo = data->getString();

    EventMessage* retval = new EventMessage(source, dest, event, gvtInfo);
    retval->setIncarnationNumber(incNum);
    return retval;
}
开发者ID:wilseypa,项目名称:warped,代码行数:12,代码来源:EventMessage.cpp

示例7: HandleIOMessageEvent

void IOHandler::HandleIOMessageEvent(const EventMessage& message) {
  MI_LOG_TRACE(logger, "HandleIOMessageEvent");
  IODescriptor* descriptor = 
      IODescriptorFactory::GetIODescriptor(message.descriptor_id);
  if (!descriptor) {
    MI_LOG_DEBUG(logger, "HandleIOCloseEvent descriptor not found:"
        << message.descriptor_id);
    HandleIOMessageFailure(message);
    return;
  }

  Channel* channel = dynamic_cast<Channel*>(descriptor);
  if (!channel) {
    MI_LOG_ERROR(logger, "IOHandler::HandleIOMessageEvent descriptor is not channel");
    HandleIOMessageFailure(message);
    return;
  }

  ProtocolMessage* protocol_message = message.GetProtocolMessage();
  if (0 != channel->EncodeMessage(protocol_message)) {
    HandleIOMessageFailure(message);
    return;    
  }

  descriptor->OnWrite();
}
开发者ID:fanfeixiang,项目名称:minotaur,代码行数:26,代码来源:io_handler.cpp

示例8: Peek

    bool Client::Peek(EventMessage &msg)
    {
        message_queue* const mq = (message_queue*)this->privateQueue;

        // check local deque for message
        if(!this->storedMessages.empty())
        {
            // get first queued element and pop it
            msg = this->storedMessages.front();
            this->storedMessages.pop_front();
            return true;
        }

        std::stringbuf msgBuffer;

        char buff[MAX_MSG_SIZE];
        size_t recvd;
        unsigned int priority;

        if(mq->try_receive(buff, MAX_MSG_SIZE, recvd, priority))
        {
            msgBuffer.sputn(buff, recvd);
            msg.deserialize(msgBuffer);

            return HandleMessage(msg, priority);
        }
        else
            return false;
        return true;
    }
开发者ID:Frizi,项目名称:cs-ipc,代码行数:30,代码来源:Client.cpp

示例9: processEvent

bool WarnDlg::processEvent(Event *e)
{
    if (e->type() == eEventMessageSent) {
        EventMessage *em = static_cast<EventMessage*>(e);
        Message *msg = em->msg();
        if (msg == m_msg) {
            m_msg = false;
            QString err = msg->getError();
            if (!err.isEmpty()) {
                showError(err);
            } else {
                QTimer::singleShot(0, this, SLOT(close()));
            }
        }
    }
    return false;
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:17,代码来源:warndlg.cpp

示例10: registerEventCallback

static void registerEventCallback(char *name, char *buf, int bufSize, void *arg, bool isSynch, int retSize, char *retData, int type)
{
printf("REGISTER EVENT CALLBACK %s %s\n", name, buf);

	EventMessage *evMessage = new EventMessage(buf);
	int msgLen;
	char *msg = evMessage->serialize(msgLen, msgManager); 
	for(int i = 0; i < numExtAddresses; i++)
	{
		try {
			msgManager->sendMessage(extAddresses[i], msg, msgLen);
		}catch(SystemException *exc)
		{
			printf("Error Sending registration message: %s\n", exc->what());
		}
	}
	((UDPNetworkManager*)udpMsgManager)->join(getMulticastAddr(evMessage->name));
	delete [] msg;
	delete evMessage;
}
开发者ID:LucyScott,项目名称:mdsplus,代码行数:20,代码来源:EventConnector.cpp

示例11: HandleMessage

 bool Client::HandleMessage(EventMessage &msg, size_t priority)
 {
     if( // dataPacket
        0 == msg.getEventType().compare(PACKET_MSG) )
     {
         if(HandlePacket(msg, *this->packetData))
             return this->HandleMessage(msg, priority); // handle recieved data
         else
             return this->Peek(msg); // packet discarded, continue peek
     }
     else
         return true;
 }
开发者ID:Frizi,项目名称:cs-ipc,代码行数:13,代码来源:Client.cpp

示例12: SendTo

    void Client::SendTo(const std::string target, EventMessage &msg)
    {
        msg.setSender(this->name);
        std::stringbuf msgBuffer;
        msg.serialize(msgBuffer);

        EventMessage targetPacket;
        targetPacket.setEventType(DIRECTSEND_MSG);
        targetPacket.pushParam(target);
        targetPacket.pushParam(msgBuffer.str());
        targetPacket.setSender(this->name);

        this->Send(targetPacket, PRIORITY_COMMAND);
    }
开发者ID:Frizi,项目名称:cs-ipc,代码行数:14,代码来源:Client.cpp

示例13: switch

bool Container::processEvent(Event *e)
{
    if (m_tabBar == NULL)
        return false;
    switch (e->type()){
    case eEventMessageReceived: {
        EventMessage *em = static_cast<EventMessage*>(e);
        Message *msg = em->msg();
        if (msg->type() == MessageStatus){
            Contact *contact = getContacts()->contact(msg->contact());
            if (contact)
                contactChanged(contact);
            return false;
        }
        if (msg->getFlags() & MESSAGE_NOVIEW)
            return false;
        if (CorePlugin::m_plugin->getContainerMode()){
            if (isActiveWindow() && !isMinimized()){
                UserWnd *userWnd = m_tabBar->currentWnd();
                if (userWnd && (userWnd->id() == msg->contact()))
                    userWnd->markAsRead();
            }else{
                UserWnd *userWnd = wnd(msg->contact());
                if (userWnd)
                    QTimer::singleShot(0, this, SLOT(flash()));
            }
        }
        // no break here - otherwise we have to duplicate the code below...
    }
    case eEventMessageRead: {
        EventMessage *em = static_cast<EventMessage*>(e);
        Message *msg = em->msg();
        UserWnd *userWnd = wnd(msg->contact());
        if (userWnd){
            bool bBold = false;
            for (list<msg_id>::iterator it = CorePlugin::m_plugin->unread.begin(); it != CorePlugin::m_plugin->unread.end(); ++it){
                if ((*it).contact != msg->contact())
                    continue;
                bBold = true;
                break;
            }
            m_tabBar->setBold(msg->contact(), bBold);
        }
        break;
    }
    case eEventActiveContact: {
        EventActiveContact *eac = static_cast<EventActiveContact*>(e);
        if (!isActiveWindow())
            return false;
        UserWnd *userWnd = m_tabBar->currentWnd();
        if (userWnd) {
            eac->setContactID(userWnd->id());
            return true;
        }
        break;
    }
    case eEventContact: {
        EventContact *ec = static_cast<EventContact*>(e);
        Contact *contact = ec->contact();
        UserWnd *userWnd = wnd(contact->id());
        if(!userWnd)
            break;
        switch(ec->action()) {
            case EventContact::eDeleted: {
                removeUserWnd(userWnd);
                break;
            }
            case EventContact::eChanged: {
                if (contact->getIgnore()){
                    removeUserWnd(userWnd);
                    break;
                }
                m_tabBar->changeTab(contact->id());
                contactChanged(contact);
                break;
            }
            case EventContact::eStatus: {
                unsigned style = 0;
                QString wrkIcons;
                QString statusIcon;
                contact->contactInfo(style, statusIcon, &wrkIcons);
                bool bTyping = false;
                while (!wrkIcons.isEmpty()){
                    if (getToken(wrkIcons, ',') == "typing"){
                        bTyping = true;
                        break;
                    }
                }
                if (userWnd->m_bTyping != bTyping){
                    userWnd->m_bTyping = bTyping;
                    if (bTyping){
                        userWnd->setStatus(g_i18n("%1 is typing", contact) .arg(contact->getName()));
                    }else{
                        userWnd->setStatus("");
                    }
                    userWnd = m_tabBar->currentWnd();
                    if (userWnd && (contact->id() == userWnd->id()))
                        m_status->message(userWnd->status());
                }
            }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:101,代码来源:container.cpp

示例14: switch

bool SoundPlugin::processEvent(SIM::Event *e)
{
    switch (e->type())
    {
    case eEventLoginStart:
        {
            playSound(value("StartUp").toString());
            break;
        }
    case eEventPluginLoadConfig:
        {
            PropertyHubPtr hub = ProfileManager::instance()->getPropertyHub("sound");
            if(!hub.isNull())
                setPropertyHub(hub);
            if(!value("StartUp").isValid())
                setValue("StartUp", "sounds/startup.ogg");
            if(!value("MessageSent").isValid())
                setValue("MessageSent", "sounds/msgsent.ogg");
            if(!value("FileDone").isValid())
                setValue("FileDone", "sounds/filedone.ogg");
            break;
        }
    case eEventContact:
        {
            EventContact *ec = static_cast<EventContact*>(e);
            if(ec->action() != EventContact::eOnline)
                break;
            Contact *contact = ec->contact();
            bool disable = contact->getUserData()->root()->value("sound/Disable").toBool();
            QString alert = contact->getUserData()->root()->value("sound/Alert").toString();
            if(alert.isEmpty())
                alert = getContacts()->userdata()->value("sound/Alert").toString();
            if (!alert.isEmpty() && !disable)
                EventPlaySound(alert).process();
            break;
        }
    case eEventMessageSent:
        {
            EventMessage *em = static_cast<EventMessage*>(e);
            Message *msg = em->msg();
            QString err = msg->getError();
            if (!err.isEmpty())
                return false;
            QString sound;
            if (msg->type() == MessageFile)
                sound = value("FileDone").toString();
            else if ((msg->getFlags() & MESSAGE_NOHISTORY) == 0)
            {
                if ((msg->getFlags() & MESSAGE_MULTIPLY) && ((msg->getFlags() & MESSAGE_LAST) == 0))
                    return false;
                sound = value("MessageSent").toString();
            }
            if (!sound.isEmpty())
                EventPlaySound(sound).process();
            break;
        }
    case eEventMessageReceived:
        {
            EventMessage *em = static_cast<EventMessage*>(e);
            Message *msg = em->msg();
            if(msg->type() == MessageStatus)
                return false;
            Contact *contact = getContacts()->contact(msg->contact());
            bool nosound, disable;
            if(contact)
            {
                nosound = contact->getUserData()->root()->value("sound/NoSoundIfActive").toBool();
                disable = contact->getUserData()->root()->value("sound/Disable").toBool();
            }
            else
            {
                nosound = getContacts()->userdata()->value("sound/NoSoundIfActive").toBool();
                disable = getContacts()->userdata()->value("sound/Disable").toBool();
            }
            if(!disable && nosound)
            {
                EventActiveContact e;
                e.process();
                if (e.contactID() == contact->id())
                    disable = true;
            }
            if(!disable)
            {
                QString sound = messageSound(msg->baseType(), contact->id());
                playSound(sound);
            }
            break;
        }
    case eEventPlaySound:
        {
            EventPlaySound *s = static_cast<EventPlaySound*>(e);
            playSound(s->sound());
            return true;
        }
    default:
        break;
    }
    return false;
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:99,代码来源:sound.cpp

示例15: switch

bool OSDPlugin::processEvent(Event *e)
{
    OSDRequest osd;
    switch (e->type()){
    case eEventContact: {
        EventContact *ec = static_cast<EventContact*>(e);
        Contact *contact = ec->contact();
        if (contact->getIgnore())
            break;
        switch(ec->action()) {
        case EventContact::eOnline: {
            osd.contact = contact->id();
            osd.type    = OSD_ALERTONLINE;
            queue.push_back(osd);
            processQueue();
            break;
        }
        case EventContact::eStatus: {
            OSDUserData *data = (OSDUserData*)(contact->getUserData(user_data_id));
            if (data){
                unsigned style = 0;
                QString wrkIcons;
                QString statusIcon;
                contact->contactInfo(style, statusIcon, &wrkIcons);
                bool bTyping = false;
                while (!wrkIcons.isEmpty()){
                    if (getToken(wrkIcons, ',') == "typing"){
                        bTyping = true;
                        break;
                    }
                }
                if (bTyping){
                    list<unsigned>::iterator it;
                    for (it = typing.begin(); it != typing.end(); ++it)
                        if ((*it) == contact->id())
                            break;
                    if (it == typing.end()){
                        typing.push_back(contact->id());
                        osd.contact = contact->id();
                        osd.type    = OSD_TYPING;
                        queue.push_back(osd);
                        processQueue();
                    }
                }else{
                    list<unsigned>::iterator it;
                    for (it = typing.begin(); it != typing.end(); ++it)
                        if ((*it) == contact->id())
                            break;
                    if (it != typing.end())
                        typing.erase(it);
                    if ((m_request.type == OSD_TYPING) && (m_request.contact == contact->id())){
                        m_timer->stop();
                        m_timer->start(100);
                    }
                }
            }
            break;
        }
        default:
            break;
        }
        break;
    }
    case eEventMessageReceived: {
        EventMessage *em = static_cast<EventMessage*>(e);
        Message *msg = em->msg();
        Contact *contact = getContacts()->contact(msg->contact());
        if (contact == NULL)
            break;
        OSDUserData *data = (OSDUserData*)(contact->getUserData(user_data_id));
        if (data == NULL)
            break;
        osd.contact = msg->contact();
	if (! core->unread.empty())
	    bHaveUnreadMessages=true;
        if (msg->type() == MessageStatus) {
            StatusMessage *smsg = (StatusMessage*)msg;
            switch (smsg->getStatus()) {
            case STATUS_AWAY:
                osd.type = OSD_ALERTAWAY;
                break;
            case STATUS_NA:
                osd.type = OSD_ALERTNA;
                break;
            case STATUS_DND:
                osd.type = OSD_ALERTDND;
                break;
            case STATUS_OCCUPIED:    /* STATUS_OCCUPIED, took over from contacts.h! */
                osd.type = OSD_ALERTOCCUPIED;
                break;
            case STATUS_FFC:
                osd.type = OSD_ALERTFFC;
                break;
            case STATUS_OFFLINE:
                osd.type = OSD_ALERTOFFLINE;
                break;
            case STATUS_ONLINE:
                osd.type = OSD_NONE;
                return false;
            default:
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:101,代码来源:osd.cpp


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