• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

開発に使用するリポジトリ


Commit MetaInfo

修訂a7a71a06ea64f6ae2e28f576b0e854b236e5732b (tree)
時間2013-08-30 05:06:21
作者Kimura Youichi <kim.upsilon@bucy...>
CommiterKimura Youichi

Log Message

REST API v1 など古いAPIのコードを除去

Change Summary

差異

--- a/OpenTween.Tests/Api/TwitterApiStatusTest.cs
+++ b/OpenTween.Tests/Api/TwitterApiStatusTest.cs
@@ -24,6 +24,7 @@ using System.Collections.Generic;
2424 using System.Linq;
2525 using System.Text;
2626 using NUnit.Framework;
27+using System.Xml;
2728
2829 namespace OpenTween.Api
2930 {
@@ -35,13 +36,13 @@ namespace OpenTween.Api
3536 {
3637 var apiStatus = new TwitterApiStatus();
3738
38- apiStatus.AccessLimit = new ApiLimit(150, 100, new DateTime(2013, 1, 1, 0, 0, 0));
39+ apiStatus.AccessLimit["/statuses/home_timeline"] = new ApiLimit(150, 100, new DateTime(2013, 1, 1, 0, 0, 0));
3940 apiStatus.MediaUploadLimit = new ApiLimit(150, 100, new DateTime(2013, 1, 1, 0, 0, 0));
4041 apiStatus.AccessLevel = TwitterApiAccessLevel.ReadWriteAndDirectMessage;
4142
4243 apiStatus.Reset();
4344
44- Assert.That(apiStatus.AccessLimit, Is.Null);
45+ Assert.That(apiStatus.AccessLimit["/statuses/home_timeline"], Is.Null);
4546 Assert.That(apiStatus.MediaUploadLimit, Is.Null);
4647 Assert.That(apiStatus.AccessLevel, Is.EqualTo(TwitterApiAccessLevel.Anonymous));
4748 }
@@ -160,18 +161,18 @@ namespace OpenTween.Api
160161
161162 var header = new Dictionary<string, string>
162163 {
163- {"X-RateLimit-Limit", "150"},
164- {"X-RateLimit-Remaining", "100"},
165- {"X-RateLimit-Reset", "1356998400"},
164+ {"X-Rate-Limit-Limit", "150"},
165+ {"X-Rate-Limit-Remaining", "100"},
166+ {"X-Rate-Limit-Reset", "1356998400"},
166167 {"X-MediaRateLimit-Limit", "30"},
167168 {"X-MediaRateLimit-Remaining", "20"},
168169 {"X-MediaRateLimit-Reset", "1357084800"},
169170 {"X-Access-Level", "read-write-directmessages"},
170171 };
171172
172- status.UpdateFromHeader(header);
173+ status.UpdateFromHeader(header, "/statuses/home_timeline");
173174
174- var rateLimit = status.AccessLimit;
175+ var rateLimit = status.AccessLimit["/statuses/home_timeline"];
175176 Assert.That(rateLimit.AccessLimitCount, Is.EqualTo(150));
176177 Assert.That(rateLimit.AccessLimitRemain, Is.EqualTo(100));
177178 Assert.That(rateLimit.AccessLimitResetDate, Is.EqualTo(new DateTime(2013, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToLocalTime()));
@@ -187,84 +188,37 @@ namespace OpenTween.Api
187188 }
188189
189190 [Test]
190- public void UpdateFromApiTest()
191+ public void UpdateFromJsonTest()
191192 {
192193 var status = new TwitterApiStatus();
193194
194195 var eventCalled = false;
195196 status.AccessLimitUpdated += (s, e) => eventCalled = true;
196197
197- var apiResponse = new TwitterDataModel.RateLimitStatus
198- {
199- HourlyLimit = 150,
200- RemainingHits = 100,
201- ResetTime = "Tue Jan 01 00:00:00 +0000 2013",
202- ResetTimeInSeconds = 1356998400,
203- Photos = new TwitterDataModel.MediaRateLimitStatus
204- {
205- DailyLimit = 30,
206- RemainingHits = 20,
207- ResetTime = "Wed Jan 02 00:00:00 +0000 2013",
208- RestTimeInSeconds = 1357084800,
209- },
210- };
211-
212- status.UpdateFromApi(apiResponse);
213-
214- var rateLimit = status.AccessLimit;
215- Assert.That(rateLimit.AccessLimitCount, Is.EqualTo(150));
216- Assert.That(rateLimit.AccessLimitRemain, Is.EqualTo(100));
217- Assert.That(rateLimit.AccessLimitResetDate, Is.EqualTo(new DateTime(2013, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToLocalTime()));
218-
219- var mediaLimit = status.MediaUploadLimit;
220- Assert.That(mediaLimit.AccessLimitCount, Is.EqualTo(30));
221- Assert.That(mediaLimit.AccessLimitRemain, Is.EqualTo(20));
222- Assert.That(mediaLimit.AccessLimitResetDate, Is.EqualTo(new DateTime(2013, 1, 2, 0, 0, 0, DateTimeKind.Utc).ToLocalTime()));
223-
224- Assert.That(eventCalled, Is.True);
225- }
226-
227- [Test]
228- public void UpdateFromApiTest2()
229- {
230- var status = new TwitterApiStatus();
231-
232- var eventCalled = false;
233- status.AccessLimitUpdated += (s, e) => eventCalled = true;
198+ var json = "{\"resources\":{\"statuses\":{\"/statuses/home_timeline\":{\"limit\":150,\"remaining\":100,\"reset\":1356998400}}}}";
199+ status.UpdateFromJson(json);
234200
235- var apiResponse = new TwitterDataModel.RateLimitStatus
236- {
237- HourlyLimit = 150,
238- RemainingHits = 100,
239- ResetTime = "Tue Jan 01 00:00:00 +0000 2013",
240- ResetTimeInSeconds = 1356998400,
241- Photos = null,
242- };
243-
244- status.UpdateFromApi(apiResponse);
245-
246- var rateLimit = status.AccessLimit;
201+ var rateLimit = status.AccessLimit["/statuses/home_timeline"];
247202 Assert.That(rateLimit.AccessLimitCount, Is.EqualTo(150));
248203 Assert.That(rateLimit.AccessLimitRemain, Is.EqualTo(100));
249204 Assert.That(rateLimit.AccessLimitResetDate, Is.EqualTo(new DateTime(2013, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToLocalTime()));
250205
251- Assert.That(status.MediaUploadLimit, Is.Null);
252-
253206 Assert.That(eventCalled, Is.True);
254207 }
255208
256209 [Test]
257- public void UpdateFromApiTest3()
210+ public void UpdateFromJsonTest2()
258211 {
259212 var status = new TwitterApiStatus();
260213
261214 var eventCalled = false;
262215 status.AccessLimitUpdated += (s, e) => eventCalled = true;
263216
264- Assert.That(() => status.UpdateFromApi(null), Throws.TypeOf<ArgumentNullException>());
217+ var json = "INVALID JSON";
218+ Assert.That(() => status.UpdateFromJson(json), Throws.TypeOf<XmlException>());
265219
266- Assert.That(status.AccessLimit, Is.Null);
267- Assert.That(status.MediaUploadLimit, Is.Null);
220+ var rateLimit = status.AccessLimit["/statuses/home_timeline"];
221+ Assert.That(rateLimit, Is.Null);
268222
269223 Assert.That(eventCalled, Is.False);
270224 }
@@ -279,7 +233,7 @@ namespace OpenTween.Api
279233
280234 Assert.That(eventCount, Is.EqualTo(0));
281235
282- apiStatus.AccessLimit = new ApiLimit(150, 100, new DateTime(2013, 1, 1, 0, 0, 0));
236+ apiStatus.AccessLimit["/statuses/home_timeline"] = new ApiLimit(150, 100, new DateTime(2013, 1, 1, 0, 0, 0));
283237 Assert.That(eventCount, Is.EqualTo(1));
284238
285239 apiStatus.Reset();
--- a/OpenTween.Tests/ToolStripAPIGaugeTest.cs
+++ b/OpenTween.Tests/ToolStripAPIGaugeTest.cs
@@ -65,39 +65,21 @@ namespace OpenTween
6565 {
6666 // toolStrip.ApiLimit の初期値は null
6767
68- Assert.That(toolStrip.Text, Is.EqualTo("API v1.1 ???/???"));
68+ Assert.That(toolStrip.Text, Is.EqualTo("API ???/???"));
6969 Assert.That(toolStrip.ToolTipText, Is.EqualTo("API rest ???/???" + Environment.NewLine + "(reset after ??? minutes)"));
7070
7171 toolStrip.ApiLimit = new ApiLimit(15, 14, DateTime.Now.AddMinutes(15));
7272
73- Assert.That(toolStrip.Text, Is.EqualTo("API v1.1 14/15"));
73+ Assert.That(toolStrip.Text, Is.EqualTo("API 14/15"));
7474 Assert.That(toolStrip.ToolTipText, Is.EqualTo("API rest 14/15" + Environment.NewLine + "(reset after 15 minutes)"));
7575
7676 toolStrip.ApiLimit = null;
7777
78- Assert.That(toolStrip.Text, Is.EqualTo("API v1.1 ???/???"));
78+ Assert.That(toolStrip.Text, Is.EqualTo("API ???/???"));
7979 Assert.That(toolStrip.ToolTipText, Is.EqualTo("API rest ???/???" + Environment.NewLine + "(reset after ??? minutes)"));
8080 }
8181 }
8282
83- [Test]
84- public void API11EnabledTest()
85- {
86- using (var toolStrip = new ToolStripAPIGauge())
87- {
88- // toolStrip.API11Enabled の初期値は true
89- Assert.That(toolStrip.Text, Is.EqualTo("API v1.1 ???/???"));
90-
91- toolStrip.API11Enabled = false;
92-
93- Assert.That(toolStrip.Text, Is.EqualTo("API v1 ???/???"));
94-
95- toolStrip.API11Enabled = true;
96-
97- Assert.That(toolStrip.Text, Is.EqualTo("API v1.1 ???/???"));
98- }
99- }
100-
10183 class TestToolStripAPIGauge : ToolStripAPIGauge
10284 {
10385 public DateTime Now { get; set; } // 現在時刻
--- a/OpenTween/Api/TwitterApiStatus.cs
+++ b/OpenTween/Api/TwitterApiStatus.cs
@@ -22,55 +22,41 @@
2222 using System;
2323 using System.Collections.Generic;
2424 using System.Linq;
25+using System.Runtime.Serialization.Json;
2526 using System.Text;
27+using System.Xml;
28+using System.Xml.Linq;
29+using System.Xml.XPath;
2630
2731 namespace OpenTween.Api
2832 {
2933 public class TwitterApiStatus
3034 {
31- public ApiLimit AccessLimit
35+ public TwitterApiAccessLevel AccessLevel { get; set; }
36+ public EndpointLimits AccessLimit { get; private set; }
37+ public ApiLimit MediaUploadLimit { get; set; }
38+
39+ public class AccessLimitUpdatedEventArgs : EventArgs
3240 {
33- get { return this._AccessLimit; }
34- set
41+ public readonly string EndpointName;
42+
43+ public AccessLimitUpdatedEventArgs(string endpointName)
3544 {
36- this._AccessLimit = value;
37- this.OnAccessLimitUpdated(EventArgs.Empty);
45+ this.EndpointName = endpointName;
3846 }
3947 }
40- public ApiLimit _AccessLimit;
41-
42- public ApiLimit MediaUploadLimit { get; set; }
43- public TwitterApiAccessLevel AccessLevel { get; set; }
44-
45- public event EventHandler AccessLimitUpdated;
48+ public event EventHandler<AccessLimitUpdatedEventArgs> AccessLimitUpdated;
4649
47- private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
48-
49- protected internal TwitterApiStatus()
50+ public TwitterApiStatus()
5051 {
51- this.Reset();
52+ this.AccessLimit = new EndpointLimits(this);
5253 }
5354
5455 public void Reset()
5556 {
56- this.AccessLimit = null;
57- this.MediaUploadLimit = null;
5857 this.AccessLevel = TwitterApiAccessLevel.Anonymous;
59- }
60-
61- public void UpdateFromHeader(IDictionary<string, string> header)
62- {
63- var rateLimit = TwitterApiStatus.ParseRateLimit(header, "X-RateLimit-");
64- if (rateLimit != null)
65- this.AccessLimit = rateLimit;
66-
67- var mediaLimit = TwitterApiStatus.ParseRateLimit(header, "X-MediaRateLimit-");
68- if (mediaLimit != null)
69- this.MediaUploadLimit = mediaLimit;
70-
71- var accessLevel = TwitterApiStatus.ParseAccessLevel(header, "X-Access-Level");
72- if (accessLevel.HasValue)
73- this.AccessLevel = accessLevel.Value;
58+ this.AccessLimit.Clear();
59+ this.MediaUploadLimit = null;
7460 }
7561
7662 internal static ApiLimit ParseRateLimit(IDictionary<string, string> header, string prefix)
@@ -121,26 +107,94 @@ namespace OpenTween.Api
121107 }
122108
123109 return null;
124- }
110+ }
125111
126- public void UpdateFromApi(TwitterDataModel.RateLimitStatus limit)
112+ public void UpdateFromHeader(IDictionary<string, string> header, string endpointName)
127113 {
128- if (limit == null)
129- throw new ArgumentNullException();
130-
131- this.AccessLimit = new ApiLimit(limit.HourlyLimit, limit.RemainingHits, MyCommon.DateTimeParse(limit.ResetTime));
114+ var rateLimit = TwitterApiStatus.ParseRateLimit(header, "X-Rate-Limit-");
115+ if (rateLimit != null)
116+ this.AccessLimit[endpointName] = rateLimit;
132117
133- var mediaLimit = limit.Photos;
118+ var mediaLimit = TwitterApiStatus.ParseRateLimit(header, "X-MediaRateLimit-");
134119 if (mediaLimit != null)
120+ this.MediaUploadLimit = mediaLimit;
121+
122+ var accessLevel = TwitterApiStatus.ParseAccessLevel(header, "X-Access-Level");
123+ if (accessLevel.HasValue)
124+ this.AccessLevel = accessLevel.Value;
125+ }
126+
127+ private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
128+
129+ public void UpdateFromJson(string json)
130+ {
131+ using (var jsonReader = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes(json), XmlDictionaryReaderQuotas.Max))
135132 {
136- this.MediaUploadLimit = new ApiLimit(mediaLimit.DailyLimit, mediaLimit.RemainingHits, MyCommon.DateTimeParse(mediaLimit.ResetTime));
133+ var xElm = XElement.Load(jsonReader);
134+ XNamespace a = "item";
135+
136+ var q =
137+ from res in xElm.Element("resources").Descendants(a + "item") // a:item 要素を列挙
138+ select new {
139+ endpointName = res.Attribute("item").Value,
140+ limit = new ApiLimit(
141+ int.Parse(res.Element("limit").Value),
142+ int.Parse(res.Element("remaining").Value),
143+ UnixEpoch.AddSeconds(long.Parse(res.Element("reset").Value)).ToLocalTime()
144+ ),
145+ };
146+ this.AccessLimit.AddAll(q.ToDictionary(x => x.endpointName, x => x.limit));
137147 }
138148 }
139149
140- protected virtual void OnAccessLimitUpdated(EventArgs e)
150+ protected virtual void OnAccessLimitUpdated(AccessLimitUpdatedEventArgs e)
141151 {
142152 if (this.AccessLimitUpdated != null)
143153 this.AccessLimitUpdated(this, e);
144154 }
155+
156+ public class EndpointLimits
157+ {
158+ public readonly TwitterApiStatus Owner;
159+
160+ private Dictionary<string, ApiLimit> innerDict = new Dictionary<string, ApiLimit>();
161+
162+ public EndpointLimits(TwitterApiStatus owner)
163+ {
164+ this.Owner = owner;
165+ }
166+
167+ public ApiLimit this[string endpoint]
168+ {
169+ get
170+ {
171+ if (this.innerDict.ContainsKey(endpoint))
172+ return this.innerDict[endpoint];
173+
174+ return null;
175+ }
176+ set
177+ {
178+ this.innerDict[endpoint] = value;
179+ this.Owner.OnAccessLimitUpdated(new AccessLimitUpdatedEventArgs(endpoint));
180+ }
181+ }
182+
183+ public void Clear()
184+ {
185+ this.innerDict.Clear();
186+ this.Owner.OnAccessLimitUpdated(new AccessLimitUpdatedEventArgs(null));
187+ }
188+
189+ public void AddAll(IDictionary<string, ApiLimit> resources)
190+ {
191+ foreach (var res in resources)
192+ {
193+ this.innerDict[res.Key] = res.Value;
194+ }
195+
196+ this.Owner.OnAccessLimitUpdated(new AccessLimitUpdatedEventArgs(null));
197+ }
198+ }
145199 }
146200 }
--- a/OpenTween/Api/TwitterApiStatus11.cs
+++ /dev/null
@@ -1,150 +0,0 @@
1-// OpenTween - Client of Twitter
2-// Copyright (c) 2013 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3-// All rights reserved.
4-//
5-// This file is part of OpenTween.
6-//
7-// This program is free software; you can redistribute it and/or modify it
8-// under the terms of the GNU General Public License as published by the Free
9-// Software Foundation; either version 3 of the License, or (at your option)
10-// any later version.
11-//
12-// This program is distributed in the hope that it will be useful, but
13-// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14-// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15-// for more details.
16-//
17-// You should have received a copy of the GNU General Public License along
18-// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
19-// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20-// Boston, MA 02110-1301, USA.
21-
22-using System;
23-using System.Collections.Generic;
24-using System.Linq;
25-using System.Runtime.Serialization.Json;
26-using System.Text;
27-using System.Xml;
28-using System.Xml.Linq;
29-using System.Xml.XPath;
30-
31-namespace OpenTween.Api
32-{
33- public class TwitterApiStatus11
34- {
35- public TwitterApiAccessLevel AccessLevel { get; set; }
36- public EndpointLimits AccessLimit { get; private set; }
37- public ApiLimit MediaUploadLimit { get; set; }
38-
39- public class AccessLimitUpdatedEventArgs : EventArgs
40- {
41- public readonly string EndpointName;
42-
43- public AccessLimitUpdatedEventArgs(string endpointName)
44- {
45- this.EndpointName = endpointName;
46- }
47- }
48- public event EventHandler<AccessLimitUpdatedEventArgs> AccessLimitUpdated;
49-
50- public TwitterApiStatus11()
51- {
52- this.AccessLimit = new EndpointLimits(this);
53- }
54-
55- public void Reset()
56- {
57- this.AccessLevel = TwitterApiAccessLevel.Anonymous;
58- this.AccessLimit.Clear();
59- this.MediaUploadLimit = null;
60- }
61-
62- public void UpdateFromHeader(IDictionary<string, string> header, string endpointName)
63- {
64- var rateLimit = TwitterApiStatus.ParseRateLimit(header, "X-Rate-Limit-");
65- if (rateLimit != null)
66- this.AccessLimit[endpointName] = rateLimit;
67-
68- var mediaLimit = TwitterApiStatus.ParseRateLimit(header, "X-MediaRateLimit-");
69- if (mediaLimit != null)
70- this.MediaUploadLimit = mediaLimit;
71-
72- var accessLevel = TwitterApiStatus.ParseAccessLevel(header, "X-Access-Level");
73- if (accessLevel.HasValue)
74- this.AccessLevel = accessLevel.Value;
75- }
76-
77- private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
78-
79- public void UpdateFromJson(string json)
80- {
81- using (var jsonReader = JsonReaderWriterFactory.CreateJsonReader(Encoding.UTF8.GetBytes(json), XmlDictionaryReaderQuotas.Max))
82- {
83- var xElm = XElement.Load(jsonReader);
84- XNamespace a = "item";
85-
86- var q =
87- from res in xElm.Element("resources").Descendants(a + "item") // a:item 要素を列挙
88- select new {
89- endpointName = res.Attribute("item").Value,
90- limit = new ApiLimit(
91- int.Parse(res.Element("limit").Value),
92- int.Parse(res.Element("remaining").Value),
93- UnixEpoch.AddSeconds(long.Parse(res.Element("reset").Value)).ToLocalTime()
94- ),
95- };
96- this.AccessLimit.AddAll(q.ToDictionary(x => x.endpointName, x => x.limit));
97- }
98- }
99-
100- protected virtual void OnAccessLimitUpdated(AccessLimitUpdatedEventArgs e)
101- {
102- if (this.AccessLimitUpdated != null)
103- this.AccessLimitUpdated(this, e);
104- }
105-
106- public class EndpointLimits
107- {
108- public readonly TwitterApiStatus11 Owner;
109-
110- private Dictionary<string, ApiLimit> innerDict = new Dictionary<string, ApiLimit>();
111-
112- public EndpointLimits(TwitterApiStatus11 owner)
113- {
114- this.Owner = owner;
115- }
116-
117- public ApiLimit this[string endpoint]
118- {
119- get
120- {
121- if (this.innerDict.ContainsKey(endpoint))
122- return this.innerDict[endpoint];
123-
124- return null;
125- }
126- set
127- {
128- this.innerDict[endpoint] = value;
129- this.Owner.OnAccessLimitUpdated(new AccessLimitUpdatedEventArgs(endpoint));
130- }
131- }
132-
133- public void Clear()
134- {
135- this.innerDict.Clear();
136- this.Owner.OnAccessLimitUpdated(new AccessLimitUpdatedEventArgs(null));
137- }
138-
139- public void AddAll(IDictionary<string, ApiLimit> resources)
140- {
141- foreach (var res in resources)
142- {
143- this.innerDict[res.Key] = res.Value;
144- }
145-
146- this.Owner.OnAccessLimitUpdated(new AccessLimitUpdatedEventArgs(null));
147- }
148- }
149- }
150-}
--- a/OpenTween/AppendSettingDialog.Designer.cs
+++ b/OpenTween/AppendSettingDialog.Designer.cs
@@ -173,8 +173,6 @@
173173 this.TextProxyAddress = new System.Windows.Forms.TextBox();
174174 this.LabelProxyPort = new System.Windows.Forms.Label();
175175 this.ConnectionPanel = new System.Windows.Forms.Panel();
176- this.TwitterSearchAPIText = new System.Windows.Forms.TextBox();
177- this.Label31 = new System.Windows.Forms.Label();
178176 this.TwitterAPIText = new System.Windows.Forms.TextBox();
179177 this.Label8 = new System.Windows.Forms.Label();
180178 this.CheckUseSsl = new System.Windows.Forms.CheckBox();
@@ -1668,8 +1666,6 @@
16681666 // ConnectionPanel
16691667 //
16701668 resources.ApplyResources(this.ConnectionPanel, "ConnectionPanel");
1671- this.ConnectionPanel.Controls.Add(this.TwitterSearchAPIText);
1672- this.ConnectionPanel.Controls.Add(this.Label31);
16731669 this.ConnectionPanel.Controls.Add(this.TwitterAPIText);
16741670 this.ConnectionPanel.Controls.Add(this.Label8);
16751671 this.ConnectionPanel.Controls.Add(this.CheckUseSsl);
@@ -1679,18 +1675,6 @@
16791675 this.ConnectionPanel.Name = "ConnectionPanel";
16801676 this.ToolTip1.SetToolTip(this.ConnectionPanel, resources.GetString("ConnectionPanel.ToolTip"));
16811677 //
1682- // TwitterSearchAPIText
1683- //
1684- resources.ApplyResources(this.TwitterSearchAPIText, "TwitterSearchAPIText");
1685- this.TwitterSearchAPIText.Name = "TwitterSearchAPIText";
1686- this.ToolTip1.SetToolTip(this.TwitterSearchAPIText, resources.GetString("TwitterSearchAPIText.ToolTip"));
1687- //
1688- // Label31
1689- //
1690- resources.ApplyResources(this.Label31, "Label31");
1691- this.Label31.Name = "Label31";
1692- this.ToolTip1.SetToolTip(this.Label31, resources.GetString("Label31.ToolTip"));
1693- //
16941678 // TwitterAPIText
16951679 //
16961680 resources.ApplyResources(this.TwitterAPIText, "TwitterAPIText");
@@ -2801,8 +2785,6 @@
28012785 internal System.Windows.Forms.TextBox TextProxyAddress;
28022786 internal System.Windows.Forms.Label LabelProxyPort;
28032787 internal System.Windows.Forms.Panel ConnectionPanel;
2804- internal System.Windows.Forms.TextBox TwitterSearchAPIText;
2805- internal System.Windows.Forms.Label Label31;
28062788 internal System.Windows.Forms.TextBox TwitterAPIText;
28072789 internal System.Windows.Forms.Label Label8;
28082790 internal System.Windows.Forms.CheckBox CheckUseSsl;
--- a/OpenTween/AppendSettingDialog.cs
+++ b/OpenTween/AppendSettingDialog.cs
@@ -436,7 +436,6 @@ namespace OpenTween
436436 UseHashSupplement = CheckHashSupple.Checked;
437437 PreviewEnable = CheckPreviewEnable.Checked;
438438 TwitterApiUrl = TwitterAPIText.Text.Trim();
439- TwitterSearchApiUrl = TwitterSearchAPIText.Text.Trim();
440439 switch (ReplyIconStateCombo.SelectedIndex)
441440 {
442441 case 0:
@@ -818,7 +817,6 @@ namespace OpenTween
818817 CheckHashSupple.Checked = UseHashSupplement;
819818 CheckPreviewEnable.Checked = PreviewEnable;
820819 TwitterAPIText.Text = TwitterApiUrl;
821- TwitterSearchAPIText.Text = TwitterSearchApiUrl;
822820 switch (ReplyIconState)
823821 {
824822 case MyCommon.REPLY_ICONSTATE.None:
@@ -1395,7 +1393,6 @@ namespace OpenTween
13951393 public bool UseAdditionalCount { get; set; }
13961394 public bool OpenUserTimeline { get; set; }
13971395 public string TwitterApiUrl { get; set; }
1398- public string TwitterSearchApiUrl { get; set; }
13991396 public string Language { get; set; }
14001397
14011398 private void Button3_Click(object sender, EventArgs e)
@@ -1711,7 +1708,6 @@ namespace OpenTween
17111708 //通信基底クラス初期化
17121709 HttpConnection.InitializeConnection(20, ptype, padr, pport, pusr, ppw);
17131710 HttpTwitter.TwitterUrl = TwitterAPIText.Text.Trim();
1714- HttpTwitter.TwitterSearchUrl = TwitterSearchAPIText.Text.Trim();
17151711 tw.Initialize("", "", "", 0);
17161712 //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4;
17171713 //this.AuthUserLabel.Text = "";
@@ -1828,11 +1824,11 @@ namespace OpenTween
18281824 private void DisplayApiMaxCount()
18291825 {
18301826 var limit = MyCommon.TwitterApiInfo.AccessLimit;
1831- if (limit != null)
1832- {
1833- LabelApiUsing.Text = string.Format(Properties.Resources.SettingAPIUse1, limit.AccessLimitCount - limit.AccessLimitRemain, limit.AccessLimitCount);
1834- }
1835- else
1827+// if (limit != null)
1828+// {
1829+// LabelApiUsing.Text = string.Format(Properties.Resources.SettingAPIUse1, limit.AccessLimitCount - limit.AccessLimitRemain, limit.AccessLimitCount);
1830+// }
1831+// else
18361832 {
18371833 LabelApiUsing.Text = string.Format(Properties.Resources.SettingAPIUse1, "???", "???");
18381834 }
@@ -1921,7 +1917,7 @@ namespace OpenTween
19211917 {
19221918 if (Twitter.AccountState == MyCommon.ACCOUNT_STATE.Valid)
19231919 {
1924- Task.Factory.StartNew(() => tw.GetInfoApi10()) //取得エラー時はinfoCountは初期状態(値:-1)
1920+ Task.Factory.StartNew(() => tw.GetInfoApi()) //取得エラー時はinfoCountは初期状態(値:-1)
19251921 .ContinueWith(t =>
19261922 {
19271923 if (this.IsHandleCreated && !this.IsDisposed)
@@ -1937,7 +1933,7 @@ namespace OpenTween
19371933 }
19381934 else
19391935 {
1940- LabelApiUsing.Text = string.Format(Properties.Resources.SettingAPIUse1, UsingApi, limit.AccessLimitCount);
1936+// LabelApiUsing.Text = string.Format(Properties.Resources.SettingAPIUse1, UsingApi, limit.AccessLimitCount);
19411937 }
19421938 }
19431939
--- a/OpenTween/AppendSettingDialog.resx
+++ b/OpenTween/AppendSettingDialog.resx
@@ -126,9 +126,6 @@
126126 <value>7</value>
127127 </data>
128128 <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
129- <data name="Label31.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
130- <value>NoControl</value>
131- </data>
132129 <data name="btnUnread.Size" type="System.Drawing.Size, System.Drawing">
133130 <value>83, 25</value>
134131 </data>
@@ -300,9 +297,6 @@
300297 <data name="IsListsIncludeRtsCheckBox.AutoSize" type="System.Boolean, mscorlib">
301298 <value>True</value>
302299 </data>
303- <data name="TwitterSearchAPIText.Size" type="System.Drawing.Size, System.Drawing">
304- <value>125, 19</value>
305- </data>
306300 <data name="&gt;&gt;btnAtSelf.Name" xml:space="preserve">
307301 <value>btnAtSelf</value>
308302 </data>
@@ -1040,9 +1034,6 @@
10401034 <data name="&gt;&gt;Label64.Parent" xml:space="preserve">
10411035 <value>ConnectionPanel</value>
10421036 </data>
1043- <data name="&gt;&gt;TwitterSearchAPIText.ZOrder" xml:space="preserve">
1044- <value>0</value>
1045- </data>
10461037 <data name="HotkeyWin.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
10471038 <value>NoControl</value>
10481039 </data>
@@ -1223,9 +1214,6 @@
12231214 <data name="HotkeyShift.TabIndex" type="System.Int32, mscorlib">
12241215 <value>2</value>
12251216 </data>
1226- <data name="&gt;&gt;Label31.Type" xml:space="preserve">
1227- <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
1228- </data>
12291217 <data name="Label52.Size" type="System.Drawing.Size, System.Drawing">
12301218 <value>131, 12</value>
12311219 </data>
@@ -2416,9 +2404,6 @@
24162404 <data name="ChkNewMentionsBlink.TabIndex" type="System.Int32, mscorlib">
24172405 <value>9</value>
24182406 </data>
2419- <data name="&gt;&gt;TwitterSearchAPIText.Parent" xml:space="preserve">
2420- <value>ConnectionPanel</value>
2421- </data>
24222407 <data name="lblDetailBackcolor.TabIndex" type="System.Int32, mscorlib">
24232408 <value>22</value>
24242409 </data>
@@ -2500,9 +2485,6 @@
25002485 <data name="&gt;&gt;Label57.ZOrder" xml:space="preserve">
25012486 <value>5</value>
25022487 </data>
2503- <data name="TwitterSearchAPIText.ToolTip" xml:space="preserve">
2504- <value />
2505- </data>
25062488 <data name="&gt;&gt;UserTimelinePeriod.Type" xml:space="preserve">
25072489 <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
25082490 </data>
@@ -3463,9 +3445,6 @@
34633445 <data name="&gt;&gt;btnInputBackcolor.ZOrder" xml:space="preserve">
34643446 <value>10</value>
34653447 </data>
3466- <data name="&gt;&gt;Label31.Name" xml:space="preserve">
3467- <value>Label31</value>
3468- </data>
34693448 <data name="Label18.ToolTip" xml:space="preserve">
34703449 <value />
34713450 </data>
@@ -3937,9 +3916,6 @@
39373916 <data name="CooperatePanel.TabIndex" type="System.Int32, mscorlib">
39383917 <value>12</value>
39393918 </data>
3940- <data name="&gt;&gt;Label31.ZOrder" xml:space="preserve">
3941- <value>1</value>
3942- </data>
39433919 <data name="&gt;&gt;CheckAlwaysTop.ZOrder" xml:space="preserve">
39443920 <value>10</value>
39453921 </data>
@@ -4147,18 +4123,12 @@
41474123 <data name="Label28.Text" xml:space="preserve">
41484124 <value>初回の更新</value>
41494125 </data>
4150- <data name="TwitterSearchAPIText.TabIndex" type="System.Int32, mscorlib">
4151- <value>7</value>
4152- </data>
41534126 <data name="GroupBox2.ToolTip" xml:space="preserve">
41544127 <value />
41554128 </data>
41564129 <data name="Label67.Location" type="System.Drawing.Point, System.Drawing">
41574130 <value>22, 24</value>
41584131 </data>
4159- <data name="&gt;&gt;TwitterSearchAPIText.Type" xml:space="preserve">
4160- <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
4161- </data>
41624132 <data name="lblTarget.Text" xml:space="preserve">
41634133 <value>This is sample.</value>
41644134 </data>
@@ -4396,9 +4366,6 @@
43964366 <data name="ComboBoxTranslateLanguage.Items48" xml:space="preserve">
43974367 <value>French (Belgium)</value>
43984368 </data>
4399- <data name="TwitterSearchAPIText.Location" type="System.Drawing.Point, System.Drawing">
4400- <value>262, 125</value>
4401- </data>
44024369 <data name="&gt;&gt;ButtonApiCalc.Name" xml:space="preserve">
44034370 <value>ButtonApiCalc</value>
44044371 </data>
@@ -4639,9 +4606,6 @@
46394606 <data name="CheckBalloonLimit.Text" xml:space="preserve">
46404607 <value>画面最小化・アイコン時のみバルーンを表示する</value>
46414608 </data>
4642- <data name="Label31.Size" type="System.Drawing.Size, System.Drawing">
4643- <value>228, 12</value>
4644- </data>
46454609 <data name="Label46.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
46464610 <value>NoControl</value>
46474611 </data>
@@ -5184,9 +5148,6 @@ Growl.CoreLibrary.DLL</value>
51845148 <data name="&gt;&gt;Label59.Name" xml:space="preserve">
51855149 <value>Label59</value>
51865150 </data>
5187- <data name="Label31.Text" xml:space="preserve">
5188- <value>Twitter SearchAPI URL (search.twitter.com)</value>
5189- </data>
51905151 <data name="&gt;&gt;Label7.Parent" xml:space="preserve">
51915152 <value>GetPeriodPanel</value>
51925153 </data>
@@ -6168,9 +6129,6 @@ Growl.CoreLibrary.DLL</value>
61686129 <data name="CheckMinimizeToTray.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
61696130 <value>NoControl</value>
61706131 </data>
6171- <data name="&gt;&gt;Label31.Parent" xml:space="preserve">
6172- <value>ConnectionPanel</value>
6173- </data>
61746132 <data name="&gt;&gt;Label62.Type" xml:space="preserve">
61756133 <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
61766134 </data>
@@ -6474,9 +6432,6 @@ Growl.CoreLibrary.DLL</value>
64746432 <data name="btnFav.ToolTip" xml:space="preserve">
64756433 <value />
64766434 </data>
6477- <data name="TwitterSearchAPIText.Visible" type="System.Boolean, mscorlib">
6478- <value>False</value>
6479- </data>
64806435 <data name="Label81.ToolTip" xml:space="preserve">
64816436 <value />
64826437 </data>
@@ -6771,9 +6726,6 @@ Growl.CoreLibrary.DLL</value>
67716726 <data name="&gt;&gt;BrowserPathText.Type" xml:space="preserve">
67726727 <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
67736728 </data>
6774- <data name="Label31.AutoSize" type="System.Boolean, mscorlib">
6775- <value>True</value>
6776- </data>
67776729 <data name="Cancel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
67786730 <value>NoControl</value>
67796731 </data>
@@ -6912,9 +6864,6 @@ Growl.CoreLibrary.DLL</value>
69126864 <data name="&gt;&gt;FollowCheckBox.Parent" xml:space="preserve">
69136865 <value>GroupBox2</value>
69146866 </data>
6915- <data name="Label31.TabIndex" type="System.Int32, mscorlib">
6916- <value>6</value>
6917- </data>
69186867 <data name="&gt;&gt;TextProxyUser.Name" xml:space="preserve">
69196868 <value>TextProxyUser</value>
69206869 </data>
@@ -7407,9 +7356,6 @@ Growl.CoreLibrary.DLL</value>
74077356 <data name="TextCountApi.TabIndex" type="System.Int32, mscorlib">
74087357 <value>1</value>
74097358 </data>
7410- <data name="Label31.ToolTip" xml:space="preserve">
7411- <value />
7412- </data>
74137359 <data name="&gt;&gt;RadioProxyIE.ZOrder" xml:space="preserve">
74147360 <value>4</value>
74157361 </data>
@@ -8007,9 +7953,6 @@ Growl.CoreLibrary.DLL</value>
80077953 <data name="&gt;&gt;Label19.Parent" xml:space="preserve">
80087954 <value>GetCountPanel</value>
80097955 </data>
8010- <data name="Label31.Visible" type="System.Boolean, mscorlib">
8011- <value>False</value>
8012- </data>
80137956 <data name="IsPreviewFoursquareCheckBox.Text" xml:space="preserve">
80147957 <value>FoursquareのURLからプレビューを表示する(非常に重くなります)</value>
80157958 </data>
@@ -8019,9 +7962,6 @@ Growl.CoreLibrary.DLL</value>
80197962 <data name="CheckAlwaysTop.ToolTip" xml:space="preserve">
80207963 <value />
80217964 </data>
8022- <data name="TwitterSearchAPIText.Text" xml:space="preserve">
8023- <value>search.twitter.com</value>
8024- </data>
80257965 <data name="&gt;&gt;lblListBackcolor.Type" xml:space="preserve">
80267966 <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
80277967 </data>
@@ -8109,9 +8049,6 @@ Growl.CoreLibrary.DLL</value>
81098049 <data name="&gt;&gt;CheckReadOldPosts.Name" xml:space="preserve">
81108050 <value>CheckReadOldPosts</value>
81118051 </data>
8112- <data name="&gt;&gt;TwitterSearchAPIText.Name" xml:space="preserve">
8113- <value>TwitterSearchAPIText</value>
8114- </data>
81158052 <data name="lblAtSelf.ToolTip" xml:space="preserve">
81168053 <value />
81178054 </data>
@@ -8442,9 +8379,6 @@ Growl.CoreLibrary.DLL</value>
84428379 <data name="&gt;&gt;CheckListMemberAddedEvent.Type" xml:space="preserve">
84438380 <value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
84448381 </data>
8445- <data name="Label31.Location" type="System.Drawing.Point, System.Drawing">
8446- <value>22, 128</value>
8447- </data>
84488382 <data name="ShortenTcoCheck.Location" type="System.Drawing.Point, System.Drawing">
84498383 <value>40, 90</value>
84508384 </data>
--- a/OpenTween/AppendSettingDialog.zh-CHS.resx
+++ b/OpenTween/AppendSettingDialog.zh-CHS.resx
@@ -616,15 +616,6 @@
616616 <data name="LabelProxyPort.Text" xml:space="preserve">
617617 <value>端口(&amp;P)</value>
618618 </data>
619- <data name="TwitterSearchAPIText.Size" type="System.Drawing.Size, System.Drawing">
620- <value>143, 19</value>
621- </data>
622- <data name="Label31.Size" type="System.Drawing.Size, System.Drawing">
623- <value>192, 12</value>
624- </data>
625- <data name="Label31.Text" xml:space="preserve">
626- <value>Search API URL (search.twitter.com)</value>
627- </data>
628619 <data name="TwitterAPIText.Size" type="System.Drawing.Size, System.Drawing">
629620 <value>143, 19</value>
630621 </data>
--- a/OpenTween/Connection/HttpTwitter.cs
+++ b/OpenTween/Connection/HttpTwitter.cs
@@ -35,15 +35,6 @@ namespace OpenTween
3535 {
3636 public class HttpTwitter : ICloneable
3737 {
38- /// <summary>
39- /// API v1.1 を有効にする否か
40- /// </summary>
41- /// <remarks>
42- /// 旧APIが使用出来なくなったら消す予定。
43- /// 静的フィールドとしているのは TwitterUserstream クラスが Clone メソッドを使用しているため
44- /// </remarks>
45- public static bool API11Enabled { get; set; }
46-
4738 //OAuth関連
4839 ///<summary>
4940 ///OAuthのアクセストークン取得先URI
@@ -74,11 +65,6 @@ namespace OpenTween
7465 private static string tks = "";
7566 private static string un = "";
7667
77- static HttpTwitter()
78- {
79- HttpTwitter.API11Enabled = true;
80- }
81-
8268 public void Initialize(string accessToken,
8369 string accessTokenSecret,
8470 string username,
@@ -200,7 +186,7 @@ namespace OpenTween
200186 //if (AppendSettingDialog.Instance.ShortenTco && AppendSettingDialog.Instance.UrlConvertAuto) param.Add("wrap_links", "true")
201187
202188 return httpCon.GetContent(PostMethod,
203- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/statuses/update.json" : "/1/statuses/update.json"),
189+ this.CreateTwitterUri("/1.1/statuses/update.json"),
204190 param,
205191 ref content,
206192 null,
@@ -220,12 +206,12 @@ namespace OpenTween
220206 binary.Add(new KeyValuePair<string, FileInfo>("media[]", mediaFile));
221207
222208 return httpCon.GetContent(PostMethod,
223- HttpTwitter.API11Enabled ? CreateTwitterUri("/1.1/statuses/update_with_media.json") : new Uri("https://upload.twitter.com/1/statuses/update_with_media.json"),
209+ this.CreateTwitterUri("/1.1/statuses/update_with_media.json"),
224210 param,
225211 binary,
226212 ref content,
227213 this.CreateRetelimitHeadersDict(),
228- HttpTwitter.API11Enabled ? CreateApi11Calllback("/statuses/update_with_media") : GetApiCallback);
214+ this.CreateApiCalllback("/statuses/update_with_media"));
229215 }
230216
231217 public HttpStatusCode DestroyStatus(long id)
@@ -233,7 +219,7 @@ namespace OpenTween
233219 string content = null;
234220
235221 return httpCon.GetContent(PostMethod,
236- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/statuses/destroy/" + id + ".json" : "/1/statuses/destroy/" + id + ".json"),
222+ this.CreateTwitterUri("/1.1/statuses/destroy/" + id + ".json"),
237223 null,
238224 ref content,
239225 null,
@@ -248,7 +234,7 @@ namespace OpenTween
248234 //if (AppendSettingDialog.Instance.ShortenTco && AppendSettingDialog.Instance.UrlConvertAuto) param.Add("wrap_links", "true")
249235
250236 return httpCon.GetContent(PostMethod,
251- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/direct_messages/new.json" : "/1/direct_messages/new.json"),
237+ this.CreateTwitterUri("/1.1/direct_messages/new.json"),
252238 param,
253239 ref content,
254240 null,
@@ -260,11 +246,10 @@ namespace OpenTween
260246 string content = null;
261247
262248 var param = new Dictionary<string, string>();
263- if (HttpTwitter.API11Enabled)
264- param.Add("id", id.ToString());
249+ param.Add("id", id.ToString());
265250
266251 return httpCon.GetContent(PostMethod,
267- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/direct_messages/destroy.json" : "/1/direct_messages/destroy/" + id + ".json"),
252+ this.CreateTwitterUri("/1.1/direct_messages/destroy.json"),
268253 param,
269254 ref content,
270255 null,
@@ -277,7 +262,7 @@ namespace OpenTween
277262 param.Add("include_entities", "true");
278263
279264 return httpCon.GetContent(PostMethod,
280- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/statuses/retweet/" + id + ".json" : "/1/statuses/retweet/" + id + ".json"),
265+ this.CreateTwitterUri("/1.1/statuses/retweet/" + id + ".json"),
281266 param,
282267 ref content,
283268 null,
@@ -290,11 +275,11 @@ namespace OpenTween
290275 param.Add("screen_name", screenName);
291276 param.Add("include_entities", "true");
292277 return httpCon.GetContent(GetMethod,
293- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/users/show.json" : "/1/users/show.json"),
278+ this.CreateTwitterUri("/1.1/users/show.json"),
294279 param,
295280 ref content,
296281 this.CreateRetelimitHeadersDict(),
297- HttpTwitter.API11Enabled ? CreateApi11Calllback("/users/show/:id") : GetApiCallback);
282+ this.CreateApiCalllback("/users/show/:id"));
298283 }
299284
300285 public HttpStatusCode CreateFriendships(string screenName, ref string content)
@@ -303,7 +288,7 @@ namespace OpenTween
303288 param.Add("screen_name", screenName);
304289
305290 return httpCon.GetContent(PostMethod,
306- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/friendships/create.json" : "/1/friendships/create.json"),
291+ this.CreateTwitterUri("/1.1/friendships/create.json"),
307292 param,
308293 ref content,
309294 null,
@@ -316,7 +301,7 @@ namespace OpenTween
316301 param.Add("screen_name", screenName);
317302
318303 return httpCon.GetContent(PostMethod,
319- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/friendships/destroy.json" : "/1/friendships/destroy.json"),
304+ this.CreateTwitterUri("/1.1/friendships/destroy.json"),
320305 param,
321306 ref content,
322307 null,
@@ -329,7 +314,7 @@ namespace OpenTween
329314 param.Add("screen_name", screenName);
330315
331316 return httpCon.GetContent(PostMethod,
332- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/blocks/create.json" : "/1/blocks/create.json"),
317+ this.CreateTwitterUri("/1.1/blocks/create.json"),
333318 param,
334319 ref content,
335320 null,
@@ -342,7 +327,7 @@ namespace OpenTween
342327 param.Add("screen_name", screenName);
343328
344329 return httpCon.GetContent(PostMethod,
345- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/blocks/destroy.json" : "/1/blocks/destroy.json"),
330+ this.CreateTwitterUri("/1.1/blocks/destroy.json"),
346331 param,
347332 ref content,
348333 null,
@@ -355,7 +340,7 @@ namespace OpenTween
355340 param.Add("screen_name", screenName);
356341
357342 return httpCon.GetContent(PostMethod,
358- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/users/report_spam.json" : "/1/report_spam.json"),
343+ this.CreateTwitterUri("/1.1/users/report_spam.json"),
359344 param,
360345 ref content,
361346 null,
@@ -369,11 +354,11 @@ namespace OpenTween
369354 param.Add("target_screen_name", targetScreenName);
370355
371356 return httpCon.GetContent(GetMethod,
372- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/friendships/show.json" : "/1/friendships/show.json"),
357+ this.CreateTwitterUri("/1.1/friendships/show.json"),
373358 param,
374359 ref content,
375360 this.CreateRetelimitHeadersDict(),
376- HttpTwitter.API11Enabled ? CreateApi11Calllback("/friendships/show") : GetApiCallback);
361+ this.CreateApiCalllback("/friendships/show"));
377362 }
378363
379364 public HttpStatusCode ShowStatuses(long id, ref string content)
@@ -381,21 +366,20 @@ namespace OpenTween
381366 Dictionary<string, string> param = new Dictionary<string, string>();
382367 param.Add("include_entities", "true");
383368 return httpCon.GetContent(GetMethod,
384- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/statuses/show/" + id + ".json" : "/1/statuses/show/" + id + ".json"),
369+ this.CreateTwitterUri("/1.1/statuses/show/" + id + ".json"),
385370 param,
386371 ref content,
387372 this.CreateRetelimitHeadersDict(),
388- HttpTwitter.API11Enabled ? CreateApi11Calllback("/statuses/show/:id") : GetApiCallback);
373+ this.CreateApiCalllback("/statuses/show/:id"));
389374 }
390375
391376 public HttpStatusCode CreateFavorites(long id, ref string content)
392377 {
393378 var param = new Dictionary<string, string>();
394- if (HttpTwitter.API11Enabled)
395- param.Add("id", id.ToString());
379+ param.Add("id", id.ToString());
396380
397381 return httpCon.GetContent(PostMethod,
398- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/favorites/create.json" : "/1/favorites/create/" + id + ".json"),
382+ this.CreateTwitterUri("/1.1/favorites/create.json"),
399383 param,
400384 ref content,
401385 null,
@@ -405,11 +389,10 @@ namespace OpenTween
405389 public HttpStatusCode DestroyFavorites(long id, ref string content)
406390 {
407391 var param = new Dictionary<string, string>();
408- if (HttpTwitter.API11Enabled)
409- param.Add("id", id.ToString());
392+ param.Add("id", id.ToString());
410393
411394 return httpCon.GetContent(PostMethod,
412- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/favorites/destroy.json" : "/1/favorites/destroy/" + id + ".json"),
395+ this.CreateTwitterUri("/1.1/favorites/destroy.json"),
413396 param,
414397 ref content,
415398 null,
@@ -429,11 +412,11 @@ namespace OpenTween
429412 param.Add("include_entities", "true");
430413
431414 return httpCon.GetContent(GetMethod,
432- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/statuses/home_timeline.json" : "/1/statuses/home_timeline.json"),
415+ this.CreateTwitterUri("/1.1/statuses/home_timeline.json"),
433416 param,
434417 ref content,
435418 this.CreateRetelimitHeadersDict(),
436- HttpTwitter.API11Enabled ? CreateApi11Calllback("/statuses/home_timeline") : GetApiCallback);
419+ this.CreateApiCalllback("/statuses/home_timeline"));
437420 }
438421
439422 public HttpStatusCode UserTimeline(long? user_id, string screen_name, int? count, long? max_id, long? since_id, ref string content)
@@ -458,33 +441,11 @@ namespace OpenTween
458441 param.Add("include_entities", "true");
459442
460443 return httpCon.GetContent(GetMethod,
461- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/statuses/user_timeline.json" : "/1/statuses/user_timeline.json"),
462- param,
463- ref content,
464- this.CreateRetelimitHeadersDict(),
465- HttpTwitter.API11Enabled ? CreateApi11Calllback("/statuses/user_timeline") : GetApiCallback);
466- }
467-
468- public HttpStatusCode PublicTimeline(int? count, long? max_id, long? since_id, ref string content)
469- {
470- Dictionary<string, string> param = new Dictionary<string, string>();
471- if (count != null)
472- param.Add("count", count.ToString());
473- if (max_id != null)
474- param.Add("max_id", max_id.ToString());
475- if (since_id != null)
476- param.Add("since_id", since_id.ToString());
477-
478- param.Add("include_entities", "true");
479-
480- // TODO: API v1.1 に存在しない API (旧 API で代替)
481-
482- return httpCon.GetContent(GetMethod,
483- CreateTwitterUri("/1/statuses/public_timeline.json"),
444+ this.CreateTwitterUri("/1.1/statuses/user_timeline.json"),
484445 param,
485446 ref content,
486447 this.CreateRetelimitHeadersDict(),
487- GetApiCallback);
448+ this.CreateApiCalllback("/statuses/user_timeline"));
488449 }
489450
490451 public HttpStatusCode Mentions(int? count, long? max_id, long? since_id, ref string content)
@@ -500,11 +461,11 @@ namespace OpenTween
500461 param.Add("include_entities", "true");
501462
502463 return httpCon.GetContent(GetMethod,
503- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/statuses/mentions_timeline.json" : "/1/statuses/mentions.json"),
464+ this.CreateTwitterUri("/1.1/statuses/mentions_timeline.json"),
504465 param,
505466 ref content,
506467 this.CreateRetelimitHeadersDict(),
507- HttpTwitter.API11Enabled ? CreateApi11Calllback("/statuses/mentions_timeline") : GetApiCallback);
468+ this.CreateApiCalllback("/statuses/mentions_timeline"));
508469 }
509470
510471 public HttpStatusCode DirectMessages(int? count, long? max_id, long? since_id, ref string content)
@@ -519,11 +480,11 @@ namespace OpenTween
519480 param.Add("include_entities", "true");
520481
521482 return httpCon.GetContent(GetMethod,
522- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/direct_messages.json" : "/1/direct_messages.json"),
483+ this.CreateTwitterUri("/1.1/direct_messages.json"),
523484 param,
524485 ref content,
525486 this.CreateRetelimitHeadersDict(),
526- HttpTwitter.API11Enabled ? CreateApi11Calllback("/direct_messages") : GetApiCallback);
487+ this.CreateApiCalllback("/direct_messages"));
527488 }
528489
529490 public HttpStatusCode DirectMessagesSent(int? count, long? max_id, long? since_id, ref string content)
@@ -538,11 +499,11 @@ namespace OpenTween
538499 param.Add("include_entities", "true");
539500
540501 return httpCon.GetContent(GetMethod,
541- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/direct_messages/sent.json" : "/1/direct_messages/sent.json"),
502+ this.CreateTwitterUri("/1.1/direct_messages/sent.json"),
542503 param,
543504 ref content,
544505 this.CreateRetelimitHeadersDict(),
545- HttpTwitter.API11Enabled ? CreateApi11Calllback("/direct_messages/sent") : GetApiCallback);
506+ this.CreateApiCalllback("/direct_messages/sent"));
546507 }
547508
548509 public HttpStatusCode Favorites(int? count, int? page, ref string content)
@@ -558,54 +519,11 @@ namespace OpenTween
558519 param.Add("include_entities", "true");
559520
560521 return httpCon.GetContent(GetMethod,
561- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/favorites/list.json" : "/1/favorites.json"),
522+ this.CreateTwitterUri("/1.1/favorites/list.json"),
562523 param,
563524 ref content,
564525 this.CreateRetelimitHeadersDict(),
565- HttpTwitter.API11Enabled ? CreateApi11Calllback("/favorites/list") : GetApiCallback);
566- }
567-
568- public HttpStatusCode PhoenixSearch(string querystr, ref string content)
569- {
570- Dictionary<string, string> param = new Dictionary<string, string>();
571- string[] tmp;
572- string[] paramstr;
573- if (string.IsNullOrEmpty(querystr)) return HttpStatusCode.BadRequest;
574-
575- tmp = querystr.Split(new char[] {'?', '&'}, StringSplitOptions.RemoveEmptyEntries);
576- foreach (string tmp2 in tmp)
577- {
578- paramstr = tmp2.Split(new char[] {'='});
579- param.Add(paramstr[0], paramstr[1]);
580- }
581-
582- return httpConVar.GetContent(GetMethod,
583- CreateTwitterUri("/phoenix_search.phoenix"),
584- param,
585- out content,
586- null,
587- MyCommon.GetAssemblyName());
588- }
589-
590- public HttpStatusCode PhoenixSearch(string words, string lang, int? rpp, int? page, long? sinceId, ref string content)
591- {
592- Dictionary<string, string> param = new Dictionary<string, string>();
593- if (!string.IsNullOrEmpty(words)) param.Add("q", words);
594- param.Add("include_entities", "1");
595- param.Add("contributor_details", "true");
596- if (!string.IsNullOrEmpty(lang)) param.Add("lang", lang);
597- if (rpp != null) param.Add("rpp", rpp.ToString());
598- if (page != null) param.Add("page", page.ToString());
599- if (sinceId != null) param.Add("since_id", sinceId.ToString());
600-
601- if (param.Count == 0) return HttpStatusCode.BadRequest;
602-
603- return httpConVar.GetContent(GetMethod,
604- CreateTwitterUri("/phoenix_search.phoenix"),
605- param,
606- out content,
607- null,
608- MyCommon.GetAssemblyName());
526+ this.CreateApiCalllback("/favorites/list"));
609527 }
610528
611529 public HttpStatusCode Search(string words, string lang, int? count, long? maxId, long? sinceId, ref string content)
@@ -613,7 +531,7 @@ namespace OpenTween
613531 Dictionary<string, string> param = new Dictionary<string, string>();
614532 if (!string.IsNullOrEmpty(words)) param.Add("q", words);
615533 if (!string.IsNullOrEmpty(lang)) param.Add("lang", lang);
616- if (count != null) param.Add(HttpTwitter.API11Enabled ? "count" : "rpp", count.ToString());
534+ if (count != null) param.Add("count", count.ToString());
617535 if (maxId != null) param.Add("max_id", maxId.ToString());
618536 if (sinceId != null) param.Add("since_id", sinceId.ToString());
619537
@@ -622,21 +540,21 @@ namespace OpenTween
622540 param.Add("result_type", "recent");
623541 param.Add("include_entities", "true");
624542 return httpCon.GetContent(GetMethod,
625- HttpTwitter.API11Enabled ? this.CreateTwitterUri("/1.1/search/tweets.json") : this.CreateTwitterSearchUri("/search.json"),
543+ this.CreateTwitterUri("/1.1/search/tweets.json"),
626544 param,
627545 ref content,
628546 this.CreateRetelimitHeadersDict(),
629- HttpTwitter.API11Enabled ? CreateApi11Calllback("/search/tweets") : GetApiCallback);
547+ this.CreateApiCalllback("/search/tweets"));
630548 }
631549
632550 public HttpStatusCode SavedSearches(ref string content)
633551 {
634552 return httpCon.GetContent(GetMethod,
635- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/saved_searches/list.json" : "/1/saved_searches.json"),
553+ this.CreateTwitterUri("/1.1/saved_searches/list.json"),
636554 null,
637555 ref content,
638556 this.CreateRetelimitHeadersDict(),
639- HttpTwitter.API11Enabled ? CreateApi11Calllback("/saved_searches/list") : GetApiCallback);
557+ this.CreateApiCalllback("/saved_searches/list"));
640558 }
641559
642560 public HttpStatusCode FollowerIds(long cursor, ref string content)
@@ -645,48 +563,45 @@ namespace OpenTween
645563 param.Add("cursor", cursor.ToString());
646564
647565 return httpCon.GetContent(GetMethod,
648- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/followers/ids.json" : "/1/followers/ids.json"),
566+ this.CreateTwitterUri("/1.1/followers/ids.json"),
649567 param,
650568 ref content,
651569 this.CreateRetelimitHeadersDict(),
652- HttpTwitter.API11Enabled ? CreateApi11Calllback("/followers/ids") : GetApiCallback);
570+ this.CreateApiCalllback("/followers/ids"));
653571 }
654572
655573 public HttpStatusCode NoRetweetIds(ref string content)
656574 {
657575 return httpCon.GetContent(GetMethod,
658- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/friendships/no_retweets/ids.json" : "/1/friendships/no_retweet_ids.json"),
576+ this.CreateTwitterUri("/1.1/friendships/no_retweets/ids.json"),
659577 null,
660578 ref content,
661579 this.CreateRetelimitHeadersDict(),
662- HttpTwitter.API11Enabled ? CreateApi11Calllback("/friendships/no_retweets/ids") : GetApiCallback);
580+ this.CreateApiCalllback("/friendships/no_retweets/ids"));
663581 }
664582
665583 public HttpStatusCode RateLimitStatus(ref string content)
666584 {
667585 return httpCon.GetContent(GetMethod,
668- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/application/rate_limit_status.json" : "/1/account/rate_limit_status.json"),
586+ this.CreateTwitterUri("/1.1/application/rate_limit_status.json"),
669587 null,
670588 ref content,
671589 this.CreateRetelimitHeadersDict(),
672- HttpTwitter.API11Enabled ? CreateApi11Calllback("/application/rate_limit_status") : GetApiCallback);
590+ this.CreateApiCalllback("/application/rate_limit_status"));
673591 }
674592
675593 #region Lists
676- public HttpStatusCode GetLists(string user, long? cursor, ref string content)
594+ public HttpStatusCode GetLists(string user, ref string content)
677595 {
678596 Dictionary<string, string> param = new Dictionary<string, string>();
679597 param.Add("screen_name", user);
680598
681- if (cursor != null)
682- param.Add("cursor", cursor.Value.ToString()); // API v1
683-
684599 return httpCon.GetContent(GetMethod,
685- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/lists/list.json" : "/1/lists.json"),
600+ this.CreateTwitterUri("/1.1/lists/list.json"),
686601 param,
687602 ref content,
688603 this.CreateRetelimitHeadersDict(),
689- HttpTwitter.API11Enabled ? CreateApi11Calllback("/lists/list") : GetApiCallback);
604+ this.CreateApiCalllback("/lists/list"));
690605 }
691606
692607 public HttpStatusCode UpdateListID(string user, string list_id, string name, Boolean isPrivate, string description, ref string content)
@@ -703,7 +618,7 @@ namespace OpenTween
703618 if (description != null) param.Add("description", description);
704619
705620 return httpCon.GetContent(PostMethod,
706- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/lists/update.json" : "/1/lists/update.json"),
621+ this.CreateTwitterUri("/1.1/lists/update.json"),
707622 param,
708623 ref content,
709624 null,
@@ -717,27 +632,24 @@ namespace OpenTween
717632 param.Add("list_id", list_id);
718633
719634 return httpCon.GetContent(PostMethod,
720- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/lists/destroy.json" : "/1/lists/destroy.json"),
635+ this.CreateTwitterUri("/1.1/lists/destroy.json"),
721636 param,
722637 ref content,
723638 null,
724639 null);
725640 }
726641
727- public HttpStatusCode GetListsSubscriptions(string user, long? cursor, ref string content)
642+ public HttpStatusCode GetListsSubscriptions(string user, ref string content)
728643 {
729644 Dictionary<string, string> param = new Dictionary<string, string>();
730645 param.Add("screen_name", user);
731646
732- if (cursor != null)
733- param.Add("cursor", cursor.Value.ToString()); // API v1
734-
735647 return httpCon.GetContent(GetMethod,
736- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/lists/subscriptions.json" : "/1/lists/subscriptions.json"),
648+ this.CreateTwitterUri("/1.1/lists/subscriptions.json"),
737649 param,
738650 ref content,
739651 this.CreateRetelimitHeadersDict(),
740- HttpTwitter.API11Enabled ? CreateApi11Calllback("/lists/subscriptions") : GetApiCallback);
652+ this.CreateApiCalllback("/lists/subscriptions"));
741653 }
742654
743655 public HttpStatusCode GetListsStatuses(long userId, long list_id, int? per_page, long? max_id, long? since_id, Boolean isRTinclude, ref string content)
@@ -748,7 +660,7 @@ namespace OpenTween
748660 param.Add("list_id", list_id.ToString());
749661 param.Add("include_rts", isRTinclude ? "true" : "false");
750662 if (per_page != null)
751- param.Add(HttpTwitter.API11Enabled ? "count" : "per_page", per_page.ToString());
663+ param.Add("count", per_page.ToString());
752664 if (max_id != null)
753665 param.Add("max_id", max_id.ToString());
754666 if (since_id != null)
@@ -756,11 +668,11 @@ namespace OpenTween
756668 param.Add("include_entities", "true");
757669
758670 return httpCon.GetContent(GetMethod,
759- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/lists/statuses.json" : "/1/lists/statuses.json"),
671+ this.CreateTwitterUri("/1.1/lists/statuses.json"),
760672 param,
761673 ref content,
762674 this.CreateRetelimitHeadersDict(),
763- HttpTwitter.API11Enabled ? CreateApi11Calllback("/lists/statuses") : GetApiCallback);
675+ this.CreateApiCalllback("/lists/statuses"));
764676 }
765677
766678 public HttpStatusCode CreateLists(string listname, Boolean isPrivate, string description, ref string content)
@@ -776,7 +688,7 @@ namespace OpenTween
776688 param.Add("description", description);
777689
778690 return httpCon.GetContent(PostMethod,
779- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/lists/create.json" : "/1/lists/create.json"),
691+ this.CreateTwitterUri("/1.1/lists/create.json"),
780692 param,
781693 ref content,
782694 null,
@@ -790,11 +702,11 @@ namespace OpenTween
790702 param.Add("list_id", list_id);
791703 param.Add("cursor", cursor.ToString());
792704 return httpCon.GetContent(GetMethod,
793- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/lists/members.json" : "/1/lists/members.json"),
705+ this.CreateTwitterUri("/1.1/lists/members.json"),
794706 param,
795707 ref content,
796708 this.CreateRetelimitHeadersDict(),
797- HttpTwitter.API11Enabled ? CreateApi11Calllback("/lists/members") : GetApiCallback);
709+ this.CreateApiCalllback("/lists/members"));
798710 }
799711
800712 public HttpStatusCode CreateListMembers(string list_id, string memberName, ref string content)
@@ -803,85 +715,37 @@ namespace OpenTween
803715 param.Add("list_id", list_id);
804716 param.Add("screen_name", memberName);
805717 return httpCon.GetContent(PostMethod,
806- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/lists/members/create.json" : "/1/lists/members/create.json"),
718+ this.CreateTwitterUri("/1.1/lists/members/create.json"),
807719 param,
808720 ref content,
809721 null,
810722 null);
811723 }
812724
813- //public HttpStatusCode CreateListMembers(string user, string list_id, string memberName, ref string content)
814- //{
815- // //正常に動かないので旧APIで様子見
816- // //Dictionary<string, string> param = new Dictionary<string, string>();
817- // //param.Add("screen_name", user)
818- // //param.Add("list_id", list_id)
819- // //param.Add("member_screen_name", memberName)
820- // //return httpCon.GetContent(PostMethod,
821- // // CreateTwitterUri("/1/lists/members/create.json"),
822- // // param,
823- // // ref content,
824- // // null,
825- // // null)
826- // Dictionary<string, string> param = new Dictionary<string, string>();
827- // param.Add("id", memberName)
828- // return httpCon.GetContent(PostMethod,
829- // CreateTwitterUri("/1/" + user + "/" + list_id + "/members.json"),
830- // param,
831- // ref content,
832- // null,
833- // null)
834- //}
835-
836725 public HttpStatusCode DeleteListMembers(string list_id, string memberName, ref string content)
837726 {
838727 Dictionary<string, string> param = new Dictionary<string, string>();
839728 param.Add("screen_name", memberName);
840729 param.Add("list_id", list_id);
841730 return httpCon.GetContent(PostMethod,
842- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/lists/members/destroy.json" : "/1/lists/members/destroy.json"),
731+ this.CreateTwitterUri("/1.1/lists/members/destroy.json"),
843732 param,
844733 ref content,
845734 null,
846735 null);
847736 }
848737
849- //public HttpStatusCode DeleteListMembers(string user, string list_id, string memberName, ref string content)
850- //{
851- // //Dictionary<string, string> param = new Dictionary<string, string>();
852- // //param.Add("screen_name", user)
853- // //param.Add("list_id", list_id)
854- // //param.Add("member_screen_name", memberName)
855- // //return httpCon.GetContent(PostMethod,
856- // // CreateTwitterUri("/1/lists/members/destroy.json"),
857- // // param,
858- // // ref content,
859- // // null,
860- // // null)
861- // Dictionary<string, string> param = new Dictionary<string, string>();
862- // param.Add("id", memberName)
863- // param.Add("_method", "DELETE")
864- // return httpCon.GetContent(PostMethod,
865- // CreateTwitterUri("/1/" + user + "/" + list_id + "/members.json"),
866- // param,
867- // ref content,
868- // null,
869- // null)
870- //}
871-
872738 public HttpStatusCode ShowListMember(string list_id, string memberName, ref string content)
873739 {
874- //新APIがmember_screen_nameもmember_user_idも無視して、自分のIDを返してくる。
875- //正式にドキュメントに反映されるまで旧APIを使用する
876740 Dictionary<string, string> param = new Dictionary<string, string>();
877741 param.Add("screen_name", memberName);
878742 param.Add("list_id", list_id);
879743 return httpCon.GetContent(GetMethod,
880- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/lists/members/show.json" : "/1/lists/members/show.json"),
744+ this.CreateTwitterUri("/1.1/lists/members/show.json"),
881745 param,
882746 ref content,
883747 this.CreateRetelimitHeadersDict(),
884- HttpTwitter.API11Enabled ? CreateApi11Calllback("/lists/members/show") : GetApiCallback);
748+ this.CreateApiCalllback("/lists/members/show"));
885749 }
886750 #endregion
887751
@@ -893,15 +757,14 @@ namespace OpenTween
893757 if (page != null)
894758 param.Add("page", page.ToString());
895759
896- if (HttpTwitter.API11Enabled)
897- param.Add("id", statusid.ToString());
760+ param.Add("id", statusid.ToString());
898761
899762 return httpCon.GetContent(GetMethod,
900- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/statuses/retweeters/ids.json" : "/1/statuses/" + statusid + "/retweeted_by/ids.json"),
763+ this.CreateTwitterUri("/1.1/statuses/retweeters/ids.json"),
901764 param,
902765 ref content,
903766 this.CreateRetelimitHeadersDict(),
904- HttpTwitter.API11Enabled ? CreateApi11Calllback("/statuses/retweeters/ids") : GetApiCallback);
767+ this.CreateApiCalllback("/statuses/retweeters/ids"));
905768 }
906769
907770 public HttpStatusCode UpdateProfile(string name, string url, string location, string description, ref string content)
@@ -915,7 +778,7 @@ namespace OpenTween
915778 param.Add("include_entities", "true");
916779
917780 return httpCon.GetContent(PostMethod,
918- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/account/update_profile.json" : "/1/account/update_profile.json"),
781+ this.CreateTwitterUri("/1.1/account/update_profile.json"),
919782 param,
920783 ref content,
921784 null,
@@ -928,7 +791,7 @@ namespace OpenTween
928791 binary.Add(new KeyValuePair<string, FileInfo>("image", imageFile));
929792
930793 return httpCon.GetContent(PostMethod,
931- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/account/update_profile_image.json" : "/1/account/update_profile_image.json"),
794+ this.CreateTwitterUri("/1.1/account/update_profile_image.json"),
932795 null,
933796 binary,
934797 ref content,
@@ -936,24 +799,6 @@ namespace OpenTween
936799 null);
937800 }
938801
939- public HttpStatusCode GetRelatedResults(long id, ref string content)
940- {
941- //認証なくても取得できるが、protectedユーザー分が抜ける
942- Dictionary<string, string> param = new Dictionary<string, string>();
943-
944- param.Add("id", id.ToString());
945- param.Add("include_entities", "true");
946-
947- // TODO: API v1.1 に存在しない API (旧 API で代替)
948-
949- return httpCon.GetContent(GetMethod,
950- CreateTwitterUri("/1/related_results/show.json"),
951- param,
952- ref content,
953- this.CreateRetelimitHeadersDict(),
954- GetApiCallback);
955- }
956-
957802 public HttpStatusCode GetBlockUserIds(ref string content, long? cursor)
958803 {
959804 var param = new Dictionary<string, string>();
@@ -962,36 +807,35 @@ namespace OpenTween
962807 param.Add("cursor", cursor.ToString());
963808
964809 return httpCon.GetContent(GetMethod,
965- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/blocks/ids.json" : "/1/blocks/blocking/ids.json"),
810+ this.CreateTwitterUri("/1.1/blocks/ids.json"),
966811 param,
967812 ref content,
968813 this.CreateRetelimitHeadersDict(),
969- HttpTwitter.API11Enabled ? CreateApi11Calllback("/blocks/ids") : GetApiCallback);
814+ this.CreateApiCalllback("/blocks/ids"));
970815 }
971816
972817 public HttpStatusCode GetConfiguration(ref string content)
973818 {
974819 return httpCon.GetContent(GetMethod,
975- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/help/configuration.json" : "/1/help/configuration.json"),
820+ this.CreateTwitterUri("/1.1/help/configuration.json"),
976821 null,
977822 ref content,
978823 this.CreateRetelimitHeadersDict(),
979- HttpTwitter.API11Enabled ? CreateApi11Calllback("/help/configuration") : GetApiCallback);
824+ this.CreateApiCalllback("/help/configuration"));
980825 }
981826
982827 public HttpStatusCode VerifyCredentials(ref string content)
983828 {
984829 return httpCon.GetContent(GetMethod,
985- CreateTwitterUri(HttpTwitter.API11Enabled ? "/1.1/account/verify_credentials.json" : "/1/account/verify_credentials.json"),
830+ this.CreateTwitterUri("/1.1/account/verify_credentials.json"),
986831 null,
987832 ref content,
988833 this.CreateRetelimitHeadersDict(),
989- HttpTwitter.API11Enabled ? CreateApi11Calllback("/account/verify_credentials") : GetApiCallback);
834+ this.CreateApiCalllback("/account/verify_credentials"));
990835 }
991836
992837 #region Proxy API
993838 private static string _twitterUrl = "api.twitter.com";
994- private static string _TwitterSearchUrl = "search.twitter.com";
995839 private static string _twitterUserStreamUrl = "userstream.twitter.com";
996840 private static string _twitterStreamUrl = "stream.twitter.com";
997841
@@ -1000,11 +844,6 @@ namespace OpenTween
1000844 return new Uri(string.Format("{0}{1}{2}", _protocol, _twitterUrl, path));
1001845 }
1002846
1003- private Uri CreateTwitterSearchUri(string path)
1004- {
1005- return new Uri(string.Format("{0}{1}{2}", _protocol, _TwitterSearchUrl, path));
1006- }
1007-
1008847 private Uri CreateTwitterUserStreamUri(string path)
1009848 {
1010849 return new Uri(string.Format("{0}{1}{2}", "https://", _twitterUserStreamUrl, path));
@@ -1023,14 +862,6 @@ namespace OpenTween
1023862 HttpOAuthApiProxy.ProxyHost = value;
1024863 }
1025864 }
1026-
1027- public static string TwitterSearchUrl
1028- {
1029- set
1030- {
1031- _TwitterSearchUrl = value;
1032- }
1033- }
1034865 #endregion
1035866
1036867 private Dictionary<string, string> CreateRetelimitHeadersDict()
@@ -1050,18 +881,12 @@ namespace OpenTween
1050881 };
1051882 }
1052883
1053- private void GetApiCallback(Object sender, HttpStatusCode code, IDictionary<string, string> headerInfo, string content)
1054- {
1055- if (code < HttpStatusCode.InternalServerError)
1056- MyCommon.TwitterApiInfo.UpdateFromHeader(headerInfo);
1057- }
1058-
1059- private CallbackDelegate CreateApi11Calllback(string endpointName)
884+ private CallbackDelegate CreateApiCalllback(string endpointName)
1060885 {
1061886 return (sender, code, headerInfo, content) =>
1062887 {
1063888 if (code < HttpStatusCode.InternalServerError)
1064- MyCommon.TwitterApiInfo11.UpdateFromHeader(headerInfo, endpointName);
889+ MyCommon.TwitterApiInfo.UpdateFromHeader(headerInfo, endpointName);
1065890 };
1066891 }
1067892
@@ -1079,7 +904,7 @@ namespace OpenTween
1079904 param.Add("track", trackwords);
1080905
1081906 return httpCon.GetContent(GetMethod,
1082- CreateTwitterUserStreamUri(HttpTwitter.API11Enabled ? "/1.1/user.json" : "/2/user.json"),
907+ this.CreateTwitterUserStreamUri("/1.1/user.json"),
1083908 param,
1084909 ref content,
1085910 userAgent);
@@ -1096,7 +921,7 @@ namespace OpenTween
1096921 param.Add("track", string.Join(",", trackwords.Split(" ".ToCharArray())));
1097922
1098923 return httpCon.GetContent(PostMethod,
1099- CreateTwitterStreamUri(HttpTwitter.API11Enabled ? "/1.1/statuses/filter.json" : "/1/statuses/filter.json"),
924+ this.CreateTwitterStreamUri("/1.1/statuses/filter.json"),
1100925 param,
1101926 ref content,
1102927 userAgent);
--- a/OpenTween/DataModel.cs
+++ b/OpenTween/DataModel.cs
@@ -506,22 +506,14 @@ namespace OpenTween
506506 }
507507
508508 [DataContract]
509- public class SearchResultPhoenix
510- {
511- [DataMember(Name = "statuses")] public List<Status> Statuses;
512- [DataMember(Name = "next_page")] public string NextPage;
513- [DataMember(Name = "error")] public string ErrMsg;
514- }
515-
516- [DataContract]
517- public class SearchResult11 // API v1.1
509+ public class SearchResult
518510 {
519511 [DataMember(Name = "statuses")] public List<Status> Statuses;
520- [DataMember(Name = "search_metadata")] public SearchMetadata11 SearchMetadata;
512+ [DataMember(Name = "search_metadata")] public SearchMetadata SearchMetadata;
521513 }
522514
523515 [DataContract]
524- public class SearchMetadata11 // API v1.1
516+ public class SearchMetadata
525517 {
526518 [DataMember(Name = "max_id")] public long MaxId;
527519 [DataMember(Name = "since_id")] public long SinceId;
@@ -535,48 +527,6 @@ namespace OpenTween
535527 }
536528
537529 [DataContract]
538- public class SearchResult
539- {
540- [DataMember(Name = "completed_in")] public double CompletedIn;
541- [DataMember(Name = "max_id")] public long MaxId;
542- [DataMember(Name = "next_page")] public string NextPageQuery;
543- [DataMember(Name = "page")] public int Page;
544- [DataMember(Name = "query")] public string Query;
545- [DataMember(Name = "refresh_url")] public string RefreshUrl;
546- [DataMember(Name = "results")] public List<SearchResultData> Results;
547- [DataMember(Name = "results_per_page")] public int ResultsPerPage;
548- [DataMember(Name = "since_id")] public long SinceId;
549- }
550-
551- [DataContract]
552- public class SearchResultData
553- {
554- [DataMember(Name = "created_at")] public string CreatedAt;
555- [DataMember(Name = "entities", IsRequired = false)] public Entities Entities;
556- [DataMember(Name = "from_user")] public string FromUser;
557- [DataMember(Name = "from_user_id")] public long FromUserId;
558- [DataMember(Name = "from_user_name")] public string FromUserName;
559- [DataMember(Name = "geo", IsRequired = false)] public Geo Geo;
560- [DataMember(Name = "id")] public long Id;
561- [DataMember(Name = "in_reply_to_status_id", IsRequired = false)] public long InReplyToStatusId = 0;
562- [DataMember(Name = "iso_language_code")] public string IsoLanguageCode;
563- [DataMember(Name = "meta_data")] public SearchMetaData MetaData;
564- [DataMember(Name = "profile_image_url")] public string ProfileImageUrl;
565- [DataMember(Name = "source")] public string Source;
566- [DataMember(Name = "text")] public string Text;
567- [DataMember(Name = "to_user")] public string ToUser;
568- [DataMember(Name = "to_user_id")] public long? ToUserId;
569- [DataMember(Name = "to_user_name")] public string ToUserName;
570- }
571-
572- [DataContract]
573- public class SearchMetaData
574- {
575- [DataMember(Name = "recent_retweets")] public int RecentRetweets;
576- [DataMember(Name = "result_type")] public string ResultType;
577- }
578-
579- [DataContract]
580530 public class PhotoSize
581531 {
582532 [DataMember(Name = "h")] public int Height;
--- a/OpenTween/MyCommon.cs
+++ b/OpenTween/MyCommon.cs
@@ -711,7 +711,6 @@ namespace OpenTween
711711 }
712712
713713 public static TwitterApiStatus TwitterApiInfo = new TwitterApiStatus();
714- public static TwitterApiStatus11 TwitterApiInfo11 = new TwitterApiStatus11();
715714
716715 public static bool IsAnimatedGif(string filename)
717716 {
--- a/OpenTween/OpenTween.csproj
+++ b/OpenTween/OpenTween.csproj
@@ -56,7 +56,6 @@
5656 <Compile Include="Api\ApiLimit.cs" />
5757 <Compile Include="Api\TwitterApiAccessLevel.cs" />
5858 <Compile Include="Api\TwitterApiStatus.cs" />
59- <Compile Include="Api\TwitterApiStatus11.cs" />
6059 <Compile Include="ApplicationEvents.cs">
6160 <SubType>Code</SubType>
6261 </Compile>
--- a/OpenTween/Resources/ChangeLog.txt
+++ b/OpenTween/Resources/ChangeLog.txt
@@ -2,6 +2,7 @@
22
33 ==== Ver 1.1.3-beta1(2013/xx/xx)
44 * CHG: Twitter API のエラー処理を改善
5+ * CHG: 旧 API v1 関連の機能を削除
56 * FIX: 「片思いユーザーリストを取得する」を無効にするとRT非表示設定が反映されない問題の修正 (thx @ui_nyan!)
67 * FIX: ブロックされているユーザーのツイートをふぁぼった時にUserStreamsが切断されてしまう問題の修正
78 * FIX: 片思いユーザーリストの更新に失敗すると希に片思い表示がされなくなる現象を修正
--- a/OpenTween/Setting/SettingCommon.cs
+++ b/OpenTween/Setting/SettingCommon.cs
@@ -192,7 +192,6 @@ namespace OpenTween
192192 public bool UseAtIdSupplement = true;
193193 public bool UseHashSupplement = true;
194194 public string TwitterUrl = "api.twitter.com";
195- public string TwitterSearchUrl = "search.twitter.com";
196195 public bool HotkeyEnabled = false;
197196 public Keys HotkeyModifier = Keys.None;
198197 public Keys HotkeyKey = Keys.None;
--- a/OpenTween/ToolStripAPIGauge.cs
+++ b/OpenTween/ToolStripAPIGauge.cs
@@ -35,32 +35,17 @@ namespace OpenTween
3535 /// API 実行回数制限に到達するまでの目安を表示する ToolStripItem
3636 /// </summary>
3737 [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All)]
38- public class ToolStripAPIGauge : ToolStripButton
38+ public class ToolStripAPIGauge : ToolStripLabel
3939 {
4040 public ToolStripAPIGauge()
4141 : base()
4242 {
43- this.Text = "API v1.1 ???/???";
43+ this.Text = "API ???/???";
4444 this.ToolTipText = "API rest ???/???" + Environment.NewLine + "(reset after ??? minutes)";
4545
4646 this.DisplayStyle = ToolStripItemDisplayStyle.Text;
4747 }
4848
49- [DefaultValue(true)]
50- [RefreshProperties(RefreshProperties.Repaint)]
51- public bool API11Enabled
52- {
53- get { return this._API11Enabled; }
54- set
55- {
56- this._API11Enabled = value;
57-
58- this.UpdateText();
59- this.Invalidate();
60- }
61- }
62- private bool _API11Enabled = true;
63-
6449 /// <summary>
6550 /// ゲージに表示される横棒グラフの幅
6651 /// </summary>
@@ -182,16 +167,10 @@ namespace OpenTween
182167
183168 protected virtual void UpdateText()
184169 {
185- string apiVersionText;
186170 string remainCountText;
187171 string maxCountText;
188172 string minuteText;
189173
190- if (this._API11Enabled)
191- apiVersionText = "v1.1";
192- else
193- apiVersionText = "v1";
194-
195174 if (this._ApiLimit == null)
196175 {
197176 remainCountText = "???";
@@ -205,8 +184,8 @@ namespace OpenTween
205184 minuteText = Math.Ceiling(this.remainMinutes).ToString();
206185 }
207186
208- var textFormat = "API {0} {1}/{2}";
209- this.Text = string.Format(textFormat, apiVersionText, remainCountText, maxCountText);
187+ var textFormat = "API {0}/{1}";
188+ this.Text = string.Format(textFormat, remainCountText, maxCountText);
210189
211190 var toolTipTextFormat =
212191 "API rest {0}/{1}" + Environment.NewLine +
--- a/OpenTween/Tween.cs
+++ b/OpenTween/Tween.cs
@@ -556,7 +556,6 @@ namespace OpenTween
556556 SecurityManager = new InternetSecurityManager(PostBrowser);
557557
558558 MyCommon.TwitterApiInfo.AccessLimitUpdated += TwitterApiStatus_AccessLimitUpdated;
559- MyCommon.TwitterApiInfo11.AccessLimitUpdated += TwitterApiStatus_AccessLimitUpdated;
560559 Microsoft.Win32.SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
561560
562561 string[] cmdArgs = Environment.GetCommandLineArgs();
@@ -648,9 +647,7 @@ namespace OpenTween
648647
649648 //設定画面への反映
650649 HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl;
651- HttpTwitter.TwitterSearchUrl = _cfgCommon.TwitterSearchUrl;
652650 SettingDialog.TwitterApiUrl = _cfgCommon.TwitterUrl;
653- SettingDialog.TwitterSearchApiUrl = _cfgCommon.TwitterSearchUrl;
654651
655652 //認証関連
656653 if (string.IsNullOrEmpty(_cfgCommon.Token)) _cfgCommon.UserName = "";
@@ -998,7 +995,6 @@ namespace OpenTween
998995 ShortUrl.BitlyId = SettingDialog.BitlyUser;
999996 ShortUrl.BitlyKey = SettingDialog.BitlyPwd;
1000997 HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl;
1001- HttpTwitter.TwitterSearchUrl = _cfgCommon.TwitterSearchUrl;
1002998 tw.TrackWord = _cfgCommon.TrackWord;
1003999 TrackToolStripMenuItem.Checked = !String.IsNullOrEmpty(tw.TrackWord);
10041000 tw.AllAtReply = _cfgCommon.AllAtReply;
@@ -3947,7 +3943,6 @@ namespace OpenTween
39473943 ShortUrl.BitlyId = SettingDialog.BitlyUser;
39483944 ShortUrl.BitlyKey = SettingDialog.BitlyPwd;
39493945 HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl;
3950- HttpTwitter.TwitterSearchUrl = _cfgCommon.TwitterSearchUrl;
39513946
39523947 HttpConnection.InitializeConnection(SettingDialog.DefaultTimeOut,
39533948 SettingDialog.SelectedProxyType,
@@ -7886,7 +7881,6 @@ namespace OpenTween
78867881 _cfgCommon.HashIsPermanent = HashMgr.IsPermanent;
78877882 _cfgCommon.HashIsNotAddToAtReply = HashMgr.IsNotAddToAtReply;
78887883 _cfgCommon.TwitterUrl = SettingDialog.TwitterApiUrl;
7889- _cfgCommon.TwitterSearchUrl = SettingDialog.TwitterSearchApiUrl;
78907884 _cfgCommon.HotkeyEnabled = SettingDialog.HotkeyEnabled;
78917885 _cfgCommon.HotkeyModifier = SettingDialog.HotkeyMod;
78927886 _cfgCommon.HotkeyKey = SettingDialog.HotkeyKey;
@@ -9508,17 +9502,10 @@ namespace OpenTween
95089502 }
95099503 else
95109504 {
9511- if (sender is TwitterApiStatus11 && this._apiGauge.API11Enabled)
9505+ var endpointName = (e as TwitterApiStatus.AccessLimitUpdatedEventArgs).EndpointName;
9506+ if (endpointName == "/statuses/home_timeline" || endpointName == null)
95129507 {
9513- var endpointName = (e as TwitterApiStatus11.AccessLimitUpdatedEventArgs).EndpointName;
9514- if (endpointName == "/statuses/home_timeline" || endpointName == null)
9515- {
9516- this._apiGauge.ApiLimit = MyCommon.TwitterApiInfo11.AccessLimit["/statuses/home_timeline"];
9517- }
9518- }
9519- else if (sender is TwitterApiStatus && !this._apiGauge.API11Enabled)
9520- {
9521- this._apiGauge.ApiLimit = MyCommon.TwitterApiInfo.AccessLimit;
9508+ this._apiGauge.ApiLimit = MyCommon.TwitterApiInfo.AccessLimit["/statuses/home_timeline"];
95229509 }
95239510 }
95249511 }
@@ -11074,10 +11061,7 @@ namespace OpenTween
1107411061
1107511062 private void GetApiInfo_Dowork(object sender, DoWorkEventArgs e)
1107611063 {
11077- if (HttpTwitter.API11Enabled)
11078- e.Result = tw.GetInfoApi11();
11079- else
11080- e.Result = tw.GetInfoApi10();
11064+ e.Result = tw.GetInfoApi();
1108111065 }
1108211066
1108311067 private void ApiUsageInfoMenuItem_Click(object sender, EventArgs e)
@@ -11088,28 +11072,14 @@ namespace OpenTween
1108811072 {
1108911073 dlg.ShowDialog();
1109011074
11091- TwitterApiAccessLevel? accessLevel = null;
11092- ApiLimit timelineLimit = null, mediaLimit = null;
11093-
11094- if (dlg.Result is TwitterApiStatus)
11095- {
11096- var result = (TwitterApiStatus)dlg.Result;
11075+ var result = (TwitterApiStatus)dlg.Result;
1109711076
11098- accessLevel = result.AccessLevel;
11099- timelineLimit = result.AccessLimit;
11100- mediaLimit = result.MediaUploadLimit;
11101- }
11102- else if (dlg.Result is TwitterApiStatus11)
11077+ if (result == null)
1110311078 {
11104- var result = (TwitterApiStatus11)dlg.Result;
11079+ var accessLevel = result.AccessLevel;
11080+ var timelineLimit = result.AccessLimit["/statuses/home_timeline"];
11081+ var mediaLimit = result.MediaUploadLimit;
1110511082
11106- accessLevel = result.AccessLevel;
11107- timelineLimit = result.AccessLimit["/statuses/home_timeline"];
11108- mediaLimit = result.MediaUploadLimit;
11109- }
11110-
11111- if (accessLevel != null)
11112- {
1111311083 tmp.AppendLine(Properties.Resources.ApiInfo1 + timelineLimit.AccessLimitCount);
1111411084 tmp.AppendLine(Properties.Resources.ApiInfo2 + timelineLimit.AccessLimitRemain);
1111511085 tmp.AppendLine(Properties.Resources.ApiInfo3 + timelineLimit.AccessLimitResetDate);
@@ -12244,18 +12214,6 @@ namespace OpenTween
1224412214 this.gh.NotifyClicked += GrowlHelper_Callback;
1224512215
1224612216 this._apiGauge = new ToolStripAPIGauge();
12247- this._apiGauge.Click += (s, e) =>
12248- {
12249- var api11Enabled = !HttpTwitter.API11Enabled;
12250-
12251- HttpTwitter.API11Enabled = api11Enabled;
12252- (s as ToolStripAPIGauge).API11Enabled = api11Enabled;
12253-
12254- if (api11Enabled)
12255- MyCommon.TwitterApiInfo11.Reset();
12256- else
12257- MyCommon.TwitterApiInfo.Reset();
12258- };
1225912217 this.StatusStrip1.Items.Insert(2, this._apiGauge);
1226012218
1226112219 this.ReplaceAppName();
--- a/OpenTween/Twitter.cs
+++ b/OpenTween/Twitter.cs
@@ -176,19 +176,13 @@ namespace OpenTween
176176 {
177177 get
178178 {
179- if (HttpTwitter.API11Enabled)
180- return MyCommon.TwitterApiInfo11.AccessLevel;
181- else
182- return MyCommon.TwitterApiInfo.AccessLevel;
179+ return MyCommon.TwitterApiInfo.AccessLevel;
183180 }
184181 }
185182
186183 protected void ResetApiStatus()
187184 {
188- if (HttpTwitter.API11Enabled)
189- MyCommon.TwitterApiInfo11.Reset();
190- else
191- MyCommon.TwitterApiInfo.Reset();
185+ MyCommon.TwitterApiInfo.Reset();
192186 }
193187
194188 public string Authenticate(string username, string password)
@@ -1747,13 +1741,12 @@ namespace OpenTween
17471741 return "";
17481742 }
17491743
1750- // API v1.1
1751- private string CreatePostsFromSearch11Json(string content, TabClass tab, bool read, int count, ref long minimumId, bool more)
1744+ private string CreatePostsFromSearchJson(string content, TabClass tab, bool read, int count, ref long minimumId, bool more)
17521745 {
1753- TwitterDataModel.SearchResult11 items;
1746+ TwitterDataModel.SearchResult items;
17541747 try
17551748 {
1756- items = MyCommon.CreateDataFromJson<TwitterDataModel.SearchResult11>(content);
1749+ items = MyCommon.CreateDataFromJson<TwitterDataModel.SearchResult>(content);
17571750 }
17581751 catch (SerializationException ex)
17591752 {
@@ -1803,152 +1796,6 @@ namespace OpenTween
18031796 return "";
18041797 }
18051798
1806- private string CreatePostsFromSearchJson(string content, TabClass tab, bool read, int count, ref long minimumId, bool more)
1807- {
1808- TwitterDataModel.SearchResult items;
1809- try
1810- {
1811- items = MyCommon.CreateDataFromJson<TwitterDataModel.SearchResult>(content);
1812- }
1813- catch (SerializationException ex)
1814- {
1815- MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
1816- return "Json Parse Error(DataContractJsonSerializer)";
1817- }
1818- catch (Exception ex)
1819- {
1820- MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
1821- return "Invalid Json!";
1822- }
1823- foreach (var result in items.Results)
1824- {
1825- PostClass post = null;
1826- post = CreatePostsFromSearchResultData(result);
1827- if (post == null) continue;
1828-
1829- if (minimumId > post.StatusId) minimumId = post.StatusId;
1830- if (!more && post.StatusId > tab.SinceId) tab.SinceId = post.StatusId;
1831- //二重取得回避
1832- lock (LockObj)
1833- {
1834- if (tab == null)
1835- {
1836- if (TabInformations.GetInstance().ContainsKey(post.StatusId)) continue;
1837- }
1838- else
1839- {
1840- if (TabInformations.GetInstance().ContainsKey(post.StatusId, tab.TabName)) continue;
1841- }
1842- }
1843-
1844- post.IsRead = read;
1845- if ((post.IsMe && !read) && this._readOwnPost) post.IsRead = true;
1846-
1847- if (tab != null) post.RelTabName = tab.TabName;
1848- //非同期アイコン取得&StatusDictionaryに追加
1849- TabInformations.GetInstance().AddPost(post);
1850- }
1851-
1852- return "";
1853- }
1854-
1855- private PostClass CreatePostsFromSearchResultData(TwitterDataModel.SearchResultData status)
1856- {
1857- var post = new PostClass();
1858- post.StatusId = status.Id;
1859- post.CreatedAt = MyCommon.DateTimeParse(status.CreatedAt);
1860- //本文
1861- post.TextFromApi = status.Text;
1862- var entities = status.Entities;
1863- post.Source = WebUtility.HtmlDecode(status.Source);
1864- post.InReplyToStatusId = status.InReplyToStatusId;
1865- post.InReplyToUser = status.ToUser;
1866- post.InReplyToUserId = status.ToUserId;
1867-
1868- if (status.Geo != null) post.PostGeo = new PostClass.StatusGeo { Lat = status.Geo.Coordinates[0], Lng = status.Geo.Coordinates[1] };
1869-
1870- if (status.FromUser == null) return null;
1871-
1872- post.UserId = status.FromUserId;
1873- post.ScreenName = status.FromUser;
1874- post.Nickname = status.FromUserName.Trim();
1875- post.ImageUrl = status.ProfileImageUrl;
1876- post.IsProtect = false;
1877- post.IsMe = post.ScreenName.ToLower().Equals(this._uname);
1878-
1879- //幻覚fav対策
1880- var tc = TabInformations.GetInstance().GetTabByType(MyCommon.TabUsageType.Favorites);
1881- post.IsFav = tc.Contains(post.StatusId) && TabInformations.GetInstance()[post.StatusId].IsFav;
1882-
1883- //HTMLに整形
1884- string textFromApi = post.TextFromApi;
1885- post.Text = this.CreateHtmlAnchor(ref textFromApi, post.ReplyToList, entities, post.Media);
1886- post.TextFromApi = this.ReplaceTextFromApi(post.TextFromApi, entities);
1887- post.TextFromApi = WebUtility.HtmlDecode(post.TextFromApi);
1888- post.TextFromApi = post.TextFromApi.Replace("<3", "\u2661");
1889-
1890- //Source整形
1891- this.CreateSource(post);
1892-
1893- post.IsReply = post.ReplyToList.Contains(this._uname);
1894- post.IsExcludeReply = false;
1895- post.IsOwl = false;
1896- post.IsDm = false;
1897-
1898- return post;
1899- }
1900-
1901- private string CreatePostsFromPhoenixSearch(string content, MyCommon.WORKERTYPE gType, TabClass tab, bool read, int count, ref long minimumId, ref string nextPageQuery)
1902- {
1903- TwitterDataModel.SearchResultPhoenix items;
1904- try
1905- {
1906- items = MyCommon.CreateDataFromJson<TwitterDataModel.SearchResultPhoenix>(content);
1907- }
1908- catch(SerializationException ex)
1909- {
1910- MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
1911- return "Json Parse Error(DataContractJsonSerializer)";
1912- }
1913- catch(Exception ex)
1914- {
1915- MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
1916- return "Invalid Json!";
1917- }
1918-
1919- nextPageQuery = items.NextPage;
1920-
1921- foreach (var status in items.Statuses)
1922- {
1923- PostClass post = null;
1924- post = CreatePostsFromStatusData(status);
1925- if (post == null) continue;
1926-
1927- if (minimumId > post.StatusId) minimumId = post.StatusId;
1928- //二重取得回避
1929- lock (LockObj)
1930- {
1931- if (tab == null)
1932- {
1933- if (TabInformations.GetInstance().ContainsKey(post.StatusId)) continue;
1934- }
1935- else
1936- {
1937- if (TabInformations.GetInstance().ContainsKey(post.StatusId, tab.TabName)) continue;
1938- }
1939- }
1940-
1941- post.IsRead = read;
1942- if (post.IsMe && !read && _readOwnPost) post.IsRead = true;
1943-
1944- if (tab != null) post.RelTabName = tab.TabName;
1945- //非同期アイコン取得&StatusDictionaryに追加
1946- TabInformations.GetInstance().AddPost(post);
1947- }
1948-
1949- return string.IsNullOrEmpty(items.ErrMsg) ? "" : "Err:" + items.ErrMsg;
1950- }
1951-
19521799 public string GetListStatus(bool read,
19531800 TabClass tab,
19541801 bool more,
@@ -2045,25 +1892,9 @@ namespace OpenTween
20451892 }
20461893 relPosts.Add(tab.RelationTargetPost.StatusId, tab.RelationTargetPost.Clone());
20471894
2048- PostClass nextPost;
2049- int loopCount;
2050-
2051- // 一周目: 非公式な related_results API を使用してリプライチェインを辿る
2052- if (!HttpTwitter.API11Enabled)
2053- {
2054- nextPost = relPosts[tab.RelationTargetPost.StatusId];
2055- loopCount = 1;
2056- do
2057- {
2058- rslt = this.GetRelatedResultsApi(nextPost, relPosts);
2059- if (!string.IsNullOrEmpty(rslt)) break;
2060- nextPost = FindTopOfReplyChain(relPosts, nextPost.StatusId);
2061- } while (nextPost.InReplyToStatusId != null && loopCount++ <= 5);
2062- }
2063-
2064- // 二周目: in_reply_to_status_id を使用してリプライチェインを辿る
2065- nextPost = FindTopOfReplyChain(relPosts, tab.RelationTargetPost.StatusId);
2066- loopCount = 1;
1895+ // in_reply_to_status_id を使用してリプライチェインを辿る
1896+ var nextPost = FindTopOfReplyChain(relPosts, tab.RelationTargetPost.StatusId);
1897+ var loopCount = 1;
20671898 while (nextPost.InReplyToStatusId != null && loopCount++ <= 20)
20681899 {
20691900 var inReplyToId = nextPost.InReplyToStatusId.Value;
@@ -2130,65 +1961,6 @@ namespace OpenTween
21301961 return rslt;
21311962 }
21321963
2133- private string GetRelatedResultsApi(PostClass post,
2134- IDictionary<Int64, PostClass> relatedPosts)
2135- {
2136- if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) return "";
2137-
2138- if (MyCommon._endingFlag) return "";
2139-
2140- HttpStatusCode res;
2141- var content = "";
2142- try
2143- {
2144- if (post.RetweetedId != null)
2145- {
2146- res = twCon.GetRelatedResults(post.RetweetedId.Value, ref content);
2147- }
2148- else
2149- {
2150- res = twCon.GetRelatedResults(post.StatusId, ref content);
2151- }
2152- }
2153- catch(Exception ex)
2154- {
2155- return "Err:" + ex.Message;
2156- }
2157-
2158- var err = this.CheckStatusCode(res, content);
2159- if (err != null) return err;
2160-
2161- List<TwitterDataModel.RelatedResult> items;
2162- try
2163- {
2164- items = MyCommon.CreateDataFromJson<List<TwitterDataModel.RelatedResult>>(content);
2165- }
2166- catch(SerializationException ex)
2167- {
2168- MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
2169- return "Json Parse Error(DataContractJsonSerializer)";
2170- }
2171- catch(Exception ex)
2172- {
2173- MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
2174- return "Invalid Json!";
2175- }
2176-
2177- foreach (var relatedData in items)
2178- {
2179- foreach (var result in relatedData.Results)
2180- {
2181- var item = CreatePostsFromStatusData(result.Status);
2182- if (item == null) continue;
2183- //非同期アイコン取得&StatusDictionaryに追加
2184- if (!relatedPosts.ContainsKey(item.StatusId))
2185- relatedPosts.Add(item.StatusId, item);
2186- }
2187- }
2188-
2189- return "";
2190- }
2191-
21921964 public string GetSearch(bool read,
21931965 TabClass tab,
21941966 bool more)
@@ -2243,80 +2015,7 @@ namespace OpenTween
22432015
22442016 if (!TabInformations.GetInstance().ContainsTab(tab)) return "";
22452017
2246- if (HttpTwitter.API11Enabled)
2247- return this.CreatePostsFromSearch11Json(content, tab, read, count, ref tab.OldestId, more);
2248- else
2249- return this.CreatePostsFromSearchJson(content, tab, read, count, ref tab.OldestId, more);
2250- }
2251-
2252- public string GetPhoenixSearch(bool read,
2253- TabClass tab,
2254- bool more)
2255- {
2256- if (MyCommon._endingFlag) return "";
2257-
2258- HttpStatusCode res;
2259- var content = "";
2260- int? page = null;
2261- long? sinceId = null;
2262- var count = 100;
2263- var querystr = "";
2264- if (AppendSettingDialog.Instance.UseAdditionalCount &&
2265- AppendSettingDialog.Instance.SearchCountApi != 0)
2266- {
2267- count = AppendSettingDialog.Instance.SearchCountApi;
2268- }
2269- if (more)
2270- {
2271- page = tab.GetSearchPage(count);
2272- if (!string.IsNullOrEmpty(tab.NextPageQuery))
2273- {
2274- querystr = tab.NextPageQuery;
2275- }
2276- }
2277- else
2278- {
2279- sinceId = tab.SinceId;
2280- }
2281-
2282- try
2283- {
2284- if (string.IsNullOrEmpty(querystr))
2285- {
2286- res = twCon.PhoenixSearch(tab.SearchWords, tab.SearchLang, count, page, sinceId, ref content);
2287- }
2288- else
2289- {
2290- res = twCon.PhoenixSearch(querystr, ref content);
2291- }
2292- }
2293- catch(Exception ex)
2294- {
2295- return "Err:" + ex.Message;
2296- }
2297- switch (res)
2298- {
2299- case HttpStatusCode.BadRequest:
2300- return "Invalid query";
2301- case HttpStatusCode.NotFound:
2302- return "Invalid query";
2303- case HttpStatusCode.PaymentRequired: //API Documentには420と書いてあるが、該当コードがないので402にしてある
2304- return "Search API Limit?";
2305- case HttpStatusCode.OK:
2306- break;
2307- default:
2308- return "Err:" + res.ToString() + "(" + MethodBase.GetCurrentMethod().Name + ")";
2309- }
2310-
2311- if (!TabInformations.GetInstance().ContainsTab(tab)) return "";
2312-
2313- //// TODO
2314- //// 遡るための情報max_idやnext_pageの情報を保持する
2315-
2316- string nextPageQuery = tab.NextPageQuery;
2317- var ret = CreatePostsFromPhoenixSearch(content, MyCommon.WORKERTYPE.PublicSearch, tab, read, count, ref tab.OldestId, ref nextPageQuery);
2318- tab.NextPageQuery = nextPageQuery;
2319- return ret;
2018+ return this.CreatePostsFromSearchJson(content, tab, read, count, ref tab.OldestId, more);
23202019 }
23212020
23222021 private string CreateDirectMessagesFromJson(string content, MyCommon.WORKERTYPE gType, bool read)
@@ -2847,89 +2546,6 @@ namespace OpenTween
28472546
28482547 public string GetListsApi()
28492548 {
2850- return HttpTwitter.API11Enabled ? this.GetListsApi11() : this.GetListsApi10();
2851- }
2852-
2853- private string GetListsApi10()
2854- {
2855- if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) return "";
2856-
2857- HttpStatusCode res;
2858- var content = "";
2859- long cursor = -1;
2860-
2861- var lists = new List<ListElement>();
2862- do
2863- {
2864- try
2865- {
2866- res = twCon.GetLists(this.Username, cursor, ref content);
2867- }
2868- catch(Exception ex)
2869- {
2870- return "Err:" + ex.Message + "(" + MethodBase.GetCurrentMethod().Name + ")";
2871- }
2872-
2873- var err = this.CheckStatusCode(res, content);
2874- if (err != null) return err;
2875-
2876- try
2877- {
2878- var lst = MyCommon.CreateDataFromJson<TwitterDataModel.Lists>(content);
2879- lists.AddRange(from le in lst.lists select new ListElement(le, this));
2880- cursor = lst.NextCursor;
2881- }
2882- catch(SerializationException ex)
2883- {
2884- MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
2885- return "Err:Json Parse Error(DataContractJsonSerializer)";
2886- }
2887- catch(Exception ex)
2888- {
2889- MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
2890- return "Err:Invalid Json!";
2891- }
2892- } while (cursor != 0);
2893-
2894- cursor = -1;
2895- do
2896- {
2897- try
2898- {
2899- res = twCon.GetListsSubscriptions(this.Username, cursor, ref content);
2900- }
2901- catch(Exception ex)
2902- {
2903- return "Err:" + ex.Message + "(" + MethodBase.GetCurrentMethod().Name + ")";
2904- }
2905-
2906- var err = this.CheckStatusCode(res, content);
2907- if (err != null) return err;
2908-
2909- try
2910- {
2911- var lst = MyCommon.CreateDataFromJson<TwitterDataModel.Lists>(content);
2912- lists.AddRange(from le in lst.lists select new ListElement(le, this));
2913- cursor = lst.NextCursor;
2914- }
2915- catch(SerializationException ex)
2916- {
2917- MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
2918- return "Err:Json Parse Error(DataContractJsonSerializer)";
2919- }
2920- catch(Exception ex)
2921- {
2922- MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
2923- return "Err:Invalid Json!";
2924- }
2925- } while (cursor != 0);
2926-
2927- TabInformations.GetInstance().SubscribableLists = lists;
2928- return "";
2929- }
2930-
2931- private string GetListsApi11()
2932- {
29332549 if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) return "";
29342550
29352551 HttpStatusCode res;
@@ -2938,7 +2554,7 @@ namespace OpenTween
29382554
29392555 try
29402556 {
2941- res = twCon.GetLists(this.Username, null, ref content);
2557+ res = twCon.GetLists(this.Username, ref content);
29422558 }
29432559 catch (Exception ex)
29442560 {
@@ -2966,7 +2582,7 @@ namespace OpenTween
29662582
29672583 try
29682584 {
2969- res = twCon.GetListsSubscriptions(this.Username, null, ref content);
2585+ res = twCon.GetListsSubscriptions(this.Username, ref content);
29702586 }
29712587 catch (Exception ex)
29722588 {
@@ -3509,43 +3125,7 @@ namespace OpenTween
35093125 }
35103126 }
35113127
3512- public TwitterApiStatus GetInfoApi10()
3513- {
3514- if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) return null;
3515-
3516- if (MyCommon._endingFlag) return null;
3517-
3518- HttpStatusCode res;
3519- var content = "";
3520- try
3521- {
3522- res = twCon.RateLimitStatus(ref content);
3523- }
3524- catch(Exception)
3525- {
3526- this.ResetApiStatus();
3527- return null;
3528- }
3529-
3530- var err = this.CheckStatusCode(res, content);
3531- if (err != null) return null;
3532-
3533- try
3534- {
3535- var limit = MyCommon.CreateDataFromJson<TwitterDataModel.RateLimitStatus>(content);
3536- MyCommon.TwitterApiInfo.UpdateFromApi(limit);
3537-
3538- return MyCommon.TwitterApiInfo;
3539- }
3540- catch(Exception ex)
3541- {
3542- MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
3543- MyCommon.TwitterApiInfo.Reset();
3544- return null;
3545- }
3546- }
3547-
3548- public TwitterApiStatus11 GetInfoApi11()
3128+ public TwitterApiStatus GetInfoApi()
35493129 {
35503130 if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) return null;
35513131
@@ -3568,8 +3148,8 @@ namespace OpenTween
35683148
35693149 try
35703150 {
3571- MyCommon.TwitterApiInfo11.UpdateFromJson(content);
3572- return MyCommon.TwitterApiInfo11;
3151+ MyCommon.TwitterApiInfo.UpdateFromJson(content);
3152+ return MyCommon.TwitterApiInfo;
35733153 }
35743154 catch (Exception ex)
35753155 {