std::cout << Indent(level) << "user data:\n";
for (size_t i = 0; i < USERDATA_NUM; ++i)
std::cout << Indent(level + 1, true) << "user data " << i << ": " << info.userData[i] << "\n";
+if (!info.authBy.empty())
+ {
+ std::cout << Indent(level) << "auth by:\n";
+ for (size_t i = 0; i < info.authBy.size(); ++i)
+ std::cout << Indent(level + 1, true) << info.authBy[i] << "\n";
+ }
}
void SimpleCallback(bool result,
time_t pingTime;
time_t lastActivityTime;
ARRAY<std::string, USERDATA_NUM> userData;
+ std::vector<std::string> authBy;
};
typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data);
if (depth == 2 && parsingAnswer)
ParseUserParams(el, attr);
+if (depth == 3 && parsingAnswer)
+ ParseAuthBy(el, attr);
+
return 0;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void GET_USER::PARSER::ParseUserParams(const char * el, const char ** attr)
{
-if (!TryParse(propertyParsers, ToLower(el), attr))
+if (strcasecmp(el, "AuthorizedBy") != 0 &&
+ !TryParse(propertyParsers, ToLower(el), attr))
error = "Invalid parameter.";
}
+//-----------------------------------------------------------------------------
+void GET_USER::PARSER::ParseAuthBy(const char * el, const char ** attr)
+{
+if (strcasecmp(el, "Auth") == 0 &&
+ attr && attr[0] && attr[1] &&
+ strcasecmp(attr[0], "name") == 0)
+ info.authBy.push_back(attr[1]);
+else
+ error = "Invalid auth description.";
+}
void ParseUser(const char * el, const char ** attr);
void ParseUserParams(const char * el, const char ** attr);
+ void ParseAuthBy(const char * el, const char ** attr);
};
} // namespace GET_USER