use the MACHINE_URI constant in the Twitter source instead of hardcoding the URL in each request

--HG--
extra : rebase_source : 9093ede2c634de0118af69af9d590cafd83172cc
This commit is contained in:
Myk Melez 2009-05-14 18:01:14 -07:00
Родитель 7ea8d442fb
Коммит e529f968ac
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -282,7 +282,8 @@ SnowlTwitter.prototype = {
request.addEventListener("error", function(e) { t.onSubscribeError(e) }, false); request.addEventListener("error", function(e) { t.onSubscribeError(e) }, false);
request.QueryInterface(Ci.nsIXMLHttpRequest); request.QueryInterface(Ci.nsIXMLHttpRequest);
request.open("GET", "https://" + this.username + "@twitter.com/statuses/friends_timeline.json?count=200", true); request.open("GET", MACHINE_URI.replace("^https://", "https://" + this.username + "@") +
"/statuses/friends_timeline.json?count=200", true);
request.setRequestHeader("Authorization", "Basic " + btoa(credentials.username + request.setRequestHeader("Authorization", "Basic " + btoa(credentials.username +
":" + ":" +
credentials.password)); credentials.password));
@ -438,7 +439,8 @@ SnowlTwitter.prototype = {
params.push("since_id=" + maxID); params.push("since_id=" + maxID);
} }
let url = "https://" + this.username + "@twitter.com/statuses/friends_timeline.json?" + params.join("&"); let url = MACHINE_URI.replace("^https://", "https://" + this.username + "@") +
"/statuses/friends_timeline.json?" + params.join("&");
this._log.debug("refresh: this.name = " + this.name + "; url = " + url); this._log.debug("refresh: this.name = " + this.name + "; url = " + url);
request.open("GET", url, true); request.open("GET", url, true);
@ -675,7 +677,7 @@ SnowlTwitter.prototype = {
} }
request.QueryInterface(Ci.nsIXMLHttpRequest); request.QueryInterface(Ci.nsIXMLHttpRequest);
request.open("POST", "https://" + this.username + "@twitter.com/statuses/update.json", true); request.open("POST", MACHINE_URI.replace("^https://", "https://" + this.username + "@") + "/statuses/update.json", true);
// If the login manager has saved credentials for this account, provide them // If the login manager has saved credentials for this account, provide them
// to the server. Otherwise, no worries, Necko will automatically call our // to the server. Otherwise, no worries, Necko will automatically call our
// notification callback, which will prompt the user to enter their credentials. // notification callback, which will prompt the user to enter their credentials.