SmsReader::SmsReader(AtChat * const chat, QObject *parent) : QObject(parent), m_atChat(chat) { m_atChat->registerNotification("+CMTI:"); connect(m_atChat, SIGNAL(notification(QString,QString)), this, SLOT(onNotification(QString,QString))); check(); }
void Channel::onMessage(Json::Value &jsonObj) { LOGI("%s:receive:%s",m_sComponentName.c_str(),jsonObj.toStyledString().data()); bool run = false; // id if (jsonObj.isMember("id")) { int msgID = jsonObj["id"].asInt(); if(jsonObj.isMember("result")){ if(msgID==m_iIDRegRequest){ run=true; m_iIDStart = jsonObj["result"].asInt(); m_iGenerateId= m_iIDStart; onRegistered(); } else if(msgID == m_iIDUnRegRequest){ run=true; m_iIDUnRegRequest=jsonObj["result"].asInt(); onUnregistered(); } else { run=true; onResult(jsonObj); } } else if(jsonObj.isMember("error")){ run=true; onError(jsonObj["error"].asString()); } else{ run=true; onRequest(jsonObj); } } else { run=true; onNotification(jsonObj); } if(!run){ LOGE("NOT USED"); } }
void ChatMsgArrivedNotify::process(InstancePtr instance, ConnectionPtr connection, const Uri& from, RequestMsg& msg) { instant_messaging_server::methods::rpc::ChatMsgArrivedNotify notify; if (!notify.ParseFromString(msg.data())) { LOG(error, "parse error! " << DUMP_STRING(msg.data())); throw ParseException(); } data_.reset(new Data); data_->sender = UserPtID(notify.sender_ua_uri(), instance->getDomain()); data_->msg_id = notify.msg_id(); data_->msg_time = notify.msg_time(); data_->content = notify.content(); data_->content_type = notify.content_type(); onNotification(instance); }
void ReminderNotify::process(InstancePtr instance, ConnectionPtr connection, const Uri& from, RequestMsg& msg) { instant_messaging_server::methods::rpc::UserNoticeArrivedNotify notify; if (!notify.ParseFromString(msg.data())) { LOG(error, "parse error! " << DUMP_STRING(msg.data())); throw ParseException(); } data_.reset(new Data); data_->sender = UserPtID(notify.sender_ua_uri(), instance->getDomain()); data_->time = notify.user_notice_time(); if (notify.user_notice_type() == "shaking-window remind") data_->reminder_type = REMINDER_SHAKING_WINDOW; else if (notify.user_notice_type() == "typing remind") data_->reminder_type = REMINDER_TYPING; else return; onNotification(instance); }