Entity account = new Entity("Account",strJID);
account.setProperty("access_token", oauth_token);
account.setProperty("access_token_secret",oauth_token_secret);
API api = new API(oauth_token,oauth_token_secret);
HTTPResponse response = api.account_verify_credentials(fromJID);
String id = null;
if(response.getResponseCode() == 200)
{
try {
JSONObject respJSON = new JSONObject(new String(response.getContent()));
id = respJSON.getString("id");
} catch (JSONException e) {
Common.log.warning(strJID + ":JSONid " + e.getMessage());
}
}
if(id == null)
{
datastore.put(account);
Common.sendMessage(fromJID,"成功绑定,但在获取饭否ID时出现未知错误");
Common.log.warning(strJID + ": " + new String(response.getContent()));
}
else
{
account.setProperty("id", id);
datastore.put(account);