void RequestMsgProcessor::onNewSystemMsg(ShareQQMsgPtr msg) { QString gid = 0; if ( msg->type() == QQMsg::kSystemG ) { QQSystemGMsg *sysg_msg = (QQSystemGMsg *)msg.data(); gid = sysg_msg->from_uin; if ( sysg_msg->sys_g_type == "group_leave" ) { qDebug() << sysg_msg->sendUin() << "had leave group" << endl; return; } } Contact *contact = Roster::instance()->contact(msg->sendUin()); if ( !contact ) { StrangerManager *mgr = StrangerManager::instance(); contact = mgr->strangerInfo(msg->sendUin()); } if ( !contact ) { connect(StrangerManager::instance(), SIGNAL(newStrangerInfo(QString, Contact *)), this, SLOT(onNewStrangerInfo(QString, Contact *))); connect(StrangerManager::instance(), SIGNAL(newStrangerIcon(QString, QPixmap)), this, SLOT(onNewStrangerIcon(QString, QPixmap))); }
GroupRequestDlg::GroupRequestDlg(const ShareQQMsgPtr msg, Contact *contact, Group *group, QWidget *parent) : QDialog(parent), ui_(new Ui::GroupRequestDlg) { assert(group); ui_->setupUi(this); QQSystemGMsg *sysg_msg = (QQSystemGMsg *)msg.data(); QString name; if (contact) { name = contact->name(); } else { name = sysg_msg->talkTo(); } ui_->lbl_request_name_->setText(name); ui_->lbl_group_name_->setText(group->name()); if ( contact ) { ui_->lbl_avatar_->setPixmap(contact->icon()); } ui_->pte_msg_->appendPlainText(msg->msg()); gid_ = msg->talkTo(); id_ = msg->sendUin(); connect(ui_->pb_ok_ , SIGNAL(clicked()), this, SLOT(slotOkClicked())); connect(ui_->pb_ignore_ , SIGNAL(clicked()), this, SLOT(slotIgnoreClicked())); connect(ui_->rb_deny_, SIGNAL(toggled(bool)), this, SLOT(slotToggleDenyReason(bool))); }
void NotifierPlugin::onNewChatMsg(ShareQQMsgPtr msg) { Notification notification; Talkable *talkable = NULL; QString sender_id; if ( msg->type() == QQMsg::kSess ) { sender_id = msg->sendUin(); talkable = StrangerManager::instance()->stranger(sender_id); } else { sender_id = msg->talkTo(); talkable = Roster::instance()->talkable(sender_id); if ( !talkable ) talkable = StrangerManager::instance()->stranger(sender_id); } QString sender_name = talkable ? talkable->markname() : sender_id; notification.title = sender_name + tr(" has new message"); notification.icon = talkable ? talkable->avatar() : QPixmap(); notification.content = msg->msg(); notification.ms_timeout = 5000; switch ( msg->type() ) { case QQMsg::kFriend: notification.type = NFT_Chat; break; case QQMsg::kGroup: notification.type = NFT_GroupChat; break; case QQMsg::kSess: notification.type = NFT_SessChat; break; } NotifyWidget *w = new NotifyWidget(notification); w->appear(); }