void PackageManager::userInfoResponse(HaypiJsonPtr result) { uint32_t action = result->at(kACTION).asInt(); uint32_t com = (*result)[kACTION_CONFIRM].asInt(); if (com != 0) { // com的值 用来描述该申请再服务端出现的问题 if ( !packageError ) packageError->handleErrorWithComCode(action, com); return; } try { switch (action) { case 3000: { parseUserInfo(result); InnerCityWindow::create()->presentRootLayer(); } break; default: { parseUserInfo(result); } break; } } catch (...) { } }
bool XmlParserDirectMsg::characters( const QString &ch ) { if ( important ) { if (parsingSender) parseUserInfo(ch); else { if ( currentTag == TAG_STATUS_ID && entry.id == Q_UINT64_C(0) ) { entry.id = ch.toULongLong(); } else if ( currentTag == TAG_USER_TEXT && entry.text.isNull() ) { entry.originalText = ch; entry.text = textToHtml( ch ); } else if ( currentTag == TAG_USER_TIMESTAMP && entry.timestamp.isNull() ) { entry.timestamp = toDateTime( ch ); entry.localTime = entry.timestamp.addSecs( timeShift ); } } } return true; }
bool XmlParser::characters( const QString &ch ) { if ( important ) { if ( parsingUser ) { parseUserInfo(ch); } else { if ( currentTag == TAG_STATUS_ID && entry.id == Q_UINT64_C(0) ) { entry.id = ch.toULongLong(); } else if ( currentTag == TAG_USER_TEXT && entry.text.isNull() ) { entry.originalText = ch; entry.originalText.replace( "<", "<" ); entry.originalText.replace( ">", ">" ); entry.text = textToHtml( entry.originalText ); } else if ( currentTag == TAG_USER_TIMESTAMP && entry.timestamp.isNull() ) { entry.timestamp = toDateTime( ch ); //utc /* It's better to leave UTC timestamp alone; Additional member localTime is added to store local time when user's system supports timezones. */ entry.localTime = entry.timestamp.addSecs( timeShift ); //now - utc } else if ( currentTag == TAG_INREPLYTO_STATUS_ID && entry.inReplyToStatusId == 0) { if( !ch.trimmed().isEmpty() ) { /* In reply to status id exists and is not empty; Hack for dealing with tags that are opened and closed at the same time, e.g. <in_reply_to_screen_name/> */ entry.hasInReplyToStatusId = true; entry.inReplyToStatusId = ch.toULongLong(); } } else if ( currentTag == TAG_INREPLYTO_SCREEN_NAME && entry.hasInReplyToStatusId ) { /* When hasInReplyToStatusId is true, inReplyToScreenName should be present, but it won't hurt to check it again just in case */ if( !ch.trimmed().isEmpty() ) { entry.inReplyToScreenName = ch; } } else if ( currentTag == TAG_FAVORITED && !favoritedSet ) { if ( ch.compare("false") == 0 ) entry.favorited = false; else entry.favorited = true; favoritedSet = true; } } } return true; }