- Timestamp:
- 2011-06-11T17:50:26Z (13 years ago)
- Branches:
- master
- Children:
- 4bc66ae
- Parents:
- de923d5
- Location:
- protocols/twitter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
rde923d5 rc0f33f1 249 249 char name[strlen(acc->user) + 9]; 250 250 url_t url; 251 251 char *s; 252 252 253 if (!url_set(&url, set_getstr(&ic->acc->set, "base_url")) || 253 254 (url.proto != PROTO_HTTP && url.proto != PROTO_HTTPS)) { … … 257 258 } 258 259 260 imcb_log(ic, "Connecting"); 261 259 262 twitter_connections = g_slist_append(twitter_connections, ic); 260 263 td = g_new0(struct twitter_data, 1); … … 267 270 if (strcmp(url.file, "/") != 0) 268 271 td->url_path = g_strdup(url.file); 269 else 272 else { 270 273 td->url_path = g_strdup(""); 271 if (g_str_has_suffix(url.host, ".com")) 272 td->prefix = g_strndup(url.host, strlen(url.host) - 4); 273 else 274 td->prefix = g_strdup(url.host); 275 274 if (g_str_has_suffix(url.host, "twitter.com")) 275 /* May fire for people who turned on HTTPS. */ 276 imcb_error(ic, "Warning: Twitter requires a version number in API calls " 277 "now. Try resetting the base_url account setting."); 278 } 279 280 /* Hacky string mangling: Turn identi.ca into identi.ca and api.twitter.com 281 into twitter, and try to be sensible if we get anything else. */ 282 td->prefix = g_strdup(url.host); 283 if (g_str_has_suffix(td->prefix, ".com")) 284 td->prefix[strlen(url.host) - 4] = '\0'; 285 if ((s = strrchr(td->prefix, '.'))) { 286 s = g_strdup(s + 1); 287 g_free(td->prefix); 288 td->prefix = s; 289 } 290 276 291 if (strstr(acc->pass, "oauth_token=")) 277 292 td->oauth_info = oauth_from_string(acc->pass, get_oauth_service(ic)); … … 283 298 if (set_getbool(&acc->set, "show_ids")) 284 299 td->log = g_new0(struct twitter_log_data, TWITTER_LOG_LENGTH); 285 286 imcb_log(ic, "Connecting");287 300 288 301 twitter_login_finish(ic); -
protocols/twitter/twitter_lib.c
rde923d5 rc0f33f1 144 144 static char *ret = NULL; 145 145 struct xt_parser *xp = NULL; 146 struct xt_node *node ;146 struct xt_node *node, *err; 147 147 148 148 g_free(ret); … … 154 154 155 155 for (node = xp->root; node; node = node->next) 156 if (( node = xt_find_node(node->children, "error")) && node->text_len > 0) {157 ret = g_strdup_printf("%s (%s)", req->status_string, node->text);156 if ((err = xt_find_node(node->children, "error")) && err->text_len > 0) { 157 ret = g_strdup_printf("%s (%s)", req->status_string, err->text); 158 158 break; 159 159 } -
protocols/twitter/twitter_lib.h
rde923d5 rc0f33f1 29 29 #include "twitter_http.h" 30 30 31 #define TWITTER_API_URL "http:// twitter.com"32 #define IDENTICA_API_URL "http ://identi.ca/api"31 #define TWITTER_API_URL "http://api.twitter.com/1" 32 #define IDENTICA_API_URL "https://identi.ca/api" 33 33 34 34 /* Status URLs */
Note: See TracChangeset
for help on using the changeset viewer.