Example #1
0
	UserPtr Deserializer::parseUser(const json& aJson, bool aAllowMe) {
		auto cid = parseCID(JsonUtil::getField<string>("cid", aJson, false));
		if (!aAllowMe && cid == ClientManager::getInstance()->getMyCID()) {
			throw std::invalid_argument("Own CID isn't allowed for this command");
		}

		return ClientManager::getInstance()->findUser(cid);
	}
Example #2
0
/**
 * Checks for type of line recived from ncid server and hands
 * it over to the line specific parsing function.
 *
 * @param line The line to parse
 */
void QNcidSocket::parseLine ( QString line )
{
    line = line.simplified();
    qDebug() << "parseLine():" << line;
    if ( line.startsWith ( "200" ) ) {
        emit connected(true);
    } else if ( line.startsWith ( "300" ) ) {
        // end of call log
    } else if ( line.startsWith ( "CIDLOG:" ) ) {
        parseCID(line);
    } else if ( line.startsWith ( "CIDINFO:" ) ) {
        // ringing
    } else if ( line.startsWith ( "CID:" ) ) {
        parseCID(line);
    } else {
        // not handeled
    }
}