void TalkServiceI::voicePush(Ice::Int fromId, Ice::Int toId, const std::string& msg, const Ice::Int messageType, const Ice::Int appId, const Ice::Current& current){ MilliTimer tStart; LOG_W(fromId, "TalkServiceI::voicePush", messageType, msg); MessageType::Type type = static_cast<MessageType::Type>(messageType); LOG_DEBUG("TalkServiceI::voicePush => accept a voicePush : fromId = " << fromId << " toId = " << toId << " msg = " << msg << " type = " << type); pugi::xml_document doc; pugi::xml_parse_result xmlResult = doc.load(msg.c_str()); if(!xmlResult || !doc.first_child()){ LOG_ERROR("TalkServiceI::voicePush => read voice xmpp error : " << xmlResult.description()); } JID from; pugi::xml_node node=doc.first_child(); pugi::xml_attribute attr ; attr = node.attribute("from"); if(attr){ from.parser(attr.value()); } else { } string fname(node.attribute("fname").value()); #ifndef INTERNATIONAL if(fname.empty()){ fname = UserNameClient::GetUserName(from.getUserId()); node.append_attribute("fname").set_value(fname.c_str()); LOG_DEBUG("此处添加fname : "<<fname); std::cout<<"添加名字 : "<<fname<<std::endl; } #endif node.append_attribute("fromCAppid").set_value(appId); string text = utils::MsgTransform::voice2text(doc.first_child()); LOG_DEBUG("TalkServiceI::voicePush => voice2text : voice = [" << msg << "] text = [" << text << "]"); stringstream os; long fromSixinId = changer_.getSixinIdByRenRenId(fromId); long toSixinId = changer_.getSixinIdByRenRenId(toId); if(fromSixinId == -1 || toSixinId == -1){ return ; } if(!text.empty()){ MessageTails::addTail(appId, type, text); string textMsg = text.append(" "); imGateForPhoneAdapterPtr_->sendMessage(fromSixinId, toSixinId, textMsg); } changer_.changToSixin("talk.m.renren.com",node); node.print(os, "\t", pugi::format_raw); voicePushV1(fromSixinId, toSixinId, os.str(), messageType, appId, current); }