Changeset 5246133 for protocols/twitter
- Timestamp:
- 2012-11-09T00:23:44Z (12 years ago)
- Branches:
- master
- Children:
- 5d749ad
- Parents:
- fb351ce
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter_lib.c
rfb351ce r5246133 169 169 { 170 170 static char *ret = NULL; 171 struct xt_node *root, *node, *err;171 json_value *root, *err; 172 172 173 173 g_free(ret); 174 174 ret = NULL; 175 175 176 /* EX:177 {"errors":[{"message":"Rate limit exceeded","code":88}]} */178 176 if (req->body_size > 0) { 179 root = xt_from_string(req->reply_body, req->body_size);180 181 for (node = root; node; node = node->next)182 if ((err = xt_find_node(node->children, "error")) && err->text_len > 0) {183 ret = g_strdup_printf("%s (%s)", req->status_string, err->text);184 break;185 }186 187 xt_free_node(root);177 root = json_parse(req->reply_body); 178 err = json_o_get(root, "errors"); 179 if (err->type == json_array && (err = err->u.array.values[0]) && 180 err->type == json_object) { 181 const char *msg = json_o_str(err, "message"); 182 if (msg) 183 ret = g_strdup_printf("%s (%s)", req->status_string, msg); 184 } 185 json_value_free(root); 188 186 } 189 187 … … 216 214 throwing 401s so I'll keep treating this one as fatal 217 215 only during login. */ 218 imcb_error(ic, "Authentication failure"); 216 imcb_error(ic, "Authentication failure (%s)", 217 twitter_parse_error(req)); 219 218 imc_logout(ic, FALSE); 220 219 return NULL;
Note: See TracChangeset
for help on using the changeset viewer.