foreach ( QQMsg *temp, msgs ) { ShareQQMsgPtr msg(temp); if ( msg.isNull() ) continue; switch ( msg->type() ) { case QQMsg::kBuddiesStatusChange: emit contactStatusChanged(msg->sendUin(), msg->status(), msg->client_type()); break; case QQMsg::kFriend: emit newFriendChatMsg(msg); break; case QQMsg::kSess: emit newSessChatMsg(msg); break; case QQMsg::kGroup: emit newGroupChatMsg(msg); break; case QQMsg::kSystem: emit newSystemMsg(msg); break; case QQMsg::kSystemG: emit newSystemGMsg(msg); break; default: qDebug() << "recived unknown message!" << endl; break; } }
MsgProcessor::MsgProcessor() { setTerminationEnabled(true); qRegisterMetaType<ShareQQMsgPtr>("ShareQQMsgPtr"); connect(this, SIGNAL(newFriendChatMsg(ShareQQMsgPtr)), this, SIGNAL(newChatMsg(ShareQQMsgPtr))); connect(this, SIGNAL(newGroupChatMsg(ShareQQMsgPtr)), this, SIGNAL(newChatMsg(ShareQQMsgPtr))); connect(this, SIGNAL(newSessChatMsg(ShareQQMsgPtr)), this, SIGNAL(newChatMsg(ShareQQMsgPtr))); }
ChatMsgProcessor::ChatMsgProcessor() { qRegisterMetaType<ContactStatus>("ContactStatus"); connect(MsgProcessor::instance(), SIGNAL(newFriendChatMsg(ShareQQMsgPtr)), this, SLOT(onNewChatMsg(ShareQQMsgPtr))); connect(MsgProcessor::instance(), SIGNAL(newGroupChatMsg(ShareQQMsgPtr)), this, SLOT(onNewChatMsg(ShareQQMsgPtr))); connect(MsgProcessor::instance(), SIGNAL(newSessChatMsg(ShareQQMsgPtr)), this, SLOT(onNewChatMsg(ShareQQMsgPtr))); connect(MsgProcessor::instance(), SIGNAL(newOffFileMsg(ShareQQMsgPtr)), this, SLOT(onNewOffFileMsg(ShareQQMsgPtr))); connect(ChatDlgManager::instance(), SIGNAL(activatedChatDlgChanged(QQChatDlg *, QQChatDlg *)), this, SLOT(onActivatedChatDlgChanged(QQChatDlg *, QQChatDlg *))); connect(StrangerManager::instance(), SIGNAL(newStrangerInfo(QString, Contact *)), this, SLOT(onNewStrangerInfo(QString, Contact *))); connect(StrangerManager::instance(), SIGNAL(newStrangerIcon(QString, QPixmap)), this, SLOT(onNewStrangerIcon(QString, QPixmap))); }