本文整理汇总了C++中JID::parser方法的典型用法代码示例。如果您正苦于以下问题:C++ JID::parser方法的具体用法?C++ JID::parser怎么用?C++ JID::parser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JID
的用法示例。
在下文中一共展示了JID::parser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: voicePush
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);
}