OSDN Git Service

HttpTwitter(TwitterApiクラスに移行済み)とその関連クラスを削除
authorKimura Youichi <kim.upsilon@bucyou.net>
Thu, 5 May 2016 13:41:45 +0000 (22:41 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Thu, 5 May 2016 17:02:29 +0000 (02:02 +0900)
OpenTween/Connection/HttpConnectionOAuth.cs [deleted file]
OpenTween/Connection/HttpOAuthApiProxy.cs [deleted file]
OpenTween/Connection/HttpTwitter.cs [deleted file]
OpenTween/Connection/IHttpConnection.cs [deleted file]
OpenTween/OpenTween.csproj
OpenTween/Tween.cs
OpenTween/Twitter.cs

diff --git a/OpenTween/Connection/HttpConnectionOAuth.cs b/OpenTween/Connection/HttpConnectionOAuth.cs
deleted file mode 100644 (file)
index 365ce40..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-// OpenTween - Client of Twitter
-// Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
-//           (c) 2008-2011 Moz (@syo68k)
-//           (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
-//           (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
-//           (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
-//           (c) 2011      spinor (@tplantd) <http://d.hatena.ne.jp/spinor/>
-// All rights reserved.
-// 
-// This file is part of OpenTween.
-// 
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-// 
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-// for more details. 
-// 
-// You should have received a copy of the GNU General Public License along
-// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
-// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
-// Boston, MA 02110-1301, USA.
-
-using HttpConnection = OpenTween.HttpConnection;
-using IHttpConnection = OpenTween.IHttpConnection;
-using OAuthUtility = OpenTween.Connection.OAuthUtility;
-using DateTime = System.DateTime;
-using DateTimeKind = System.DateTimeKind;
-using Random = System.Random;
-using HttpWebRequest = System.Net.HttpWebRequest;
-using HttpStatusCode = System.Net.HttpStatusCode;
-using Uri = System.Uri;
-using System.Collections.Generic; // for Dictionary<TKey, TValue>, List<T>, KeyValuePair<TKey, TValue>, SortedDictionary<TKey, TValue>
-using CallbackDelegate = OpenTween.CallbackDelegate;
-using StackFrame = System.Diagnostics.StackFrame;
-using FileInfo = System.IO.FileInfo;
-using Stream = System.IO.Stream;
-using HttpWebResponse = System.Net.HttpWebResponse;
-using WebException = System.Net.WebException;
-using WebExceptionStatus = System.Net.WebExceptionStatus;
-using Exception = System.Exception;
-using NameValueCollection = System.Collections.Specialized.NameValueCollection;
-using Convert = System.Convert;
-using InvalidDataException = System.IO.InvalidDataException;
-using UriBuilder = System.UriBuilder;
-using Environment = System.Environment;
-using StringBuilder = System.Text.StringBuilder;
-using HttpRequestHeader = System.Net.HttpRequestHeader;
-using HMACSHA1 = System.Security.Cryptography.HMACSHA1;
-using Encoding = System.Text.Encoding;
-using System;
-
-namespace OpenTween
-{
-       /// <summary>
-       /// OAuth認証を使用するHTTP通信。HMAC-SHA1固定
-       /// </summary>
-       /// <remarks>
-       /// 使用前に認証情報を設定する。認証確認を伴う場合はAuthenticate系のメソッドを、認証不要な場合はInitializeを呼ぶこと。
-       /// </remarks>
-       abstract public class HttpConnectionOAuth : HttpConnection, IHttpConnection
-       {
-               /// <summary>
-               /// OAuthのアクセストークン。永続化可能(ユーザー取り消しの可能性はある)。
-               /// </summary>
-               private string token = "";
-
-               /// <summary>
-               /// OAuthの署名作成用秘密アクセストークン。永続化可能(ユーザー取り消しの可能性はある)。
-               /// </summary>
-               private string tokenSecret = "";
-
-               /// <summary>
-               /// OAuthのコンシューマー鍵
-               /// </summary>
-               protected string consumerKey;
-
-               /// <summary>
-               /// OAuthの署名作成用秘密コンシューマーデータ
-               /// </summary>
-               protected string consumerSecret;
-
-               /// <summary>
-               /// 認証完了時の応答からuserIdentKey情報に基づいて取得するユーザー情報
-               /// </summary>
-               private string authorizedUsername = "";
-
-               /// <summary>
-               /// 認証完了時の応答からuserIdentKey情報に基づいて取得するユーザー情報
-               /// </summary>
-               private long authorizedUserId;
-
-               /// <summary>
-               /// Stream用のHttpWebRequest
-               /// </summary>
-               private HttpWebRequest streamReq = null;
-
-               /// <summary>
-               /// OAuth認証で指定のURLとHTTP通信を行い、結果を返す
-               /// </summary>
-               /// <param name="method">HTTP通信メソッド(GET/HEAD/POST/PUT/DELETE)</param>
-               /// <param name="requestUri">通信先URI</param>
-               /// <param name="param">GET時のクエリ、またはPOST時のエンティティボディ</param>
-               /// <param name="content">[OUT]HTTP応答のボディデータ</param>
-               /// <param name="headerInfo">[IN/OUT]HTTP応答のヘッダ情報。必要なヘッダ名を事前に設定しておくこと</param>
-               /// <param name="callback">処理終了直前に呼ばれるコールバック関数のデリゲート 不要な場合はnullを渡すこと</param>
-               /// <returns>HTTP応答のステータスコード</returns>
-               public HttpStatusCode GetContent( string method,
-                                                 Uri requestUri,
-                                                 Dictionary< string, string > param,
-                                                 ref string content,
-                                                 Dictionary< string, string > headerInfo,
-                                                 CallbackDelegate callback )
-               {
-                       // 認証済かチェック
-                       if ( string.IsNullOrEmpty( token ) )
-                               return HttpStatusCode.Unauthorized;
-
-                       HttpWebRequest webReq = this.CreateRequest( method, requestUri, param, gzip: true );
-                       // OAuth認証ヘッダを付加
-                       this.AppendOAuthInfo( webReq, param, token, tokenSecret );
-
-                       HttpStatusCode code;
-                       if ( content == null )
-                               code = this.GetResponse( webReq, headerInfo );
-                       else
-                               code = this.GetResponse( webReq, out content, headerInfo );
-
-                       if ( callback != null )
-                       {
-                               StackFrame frame = new StackFrame( 1 );
-                               callback( frame.GetMethod().Name, code, headerInfo, content );
-                       }
-                       return code;
-               }
-
-               /// <summary>
-               /// バイナリアップロード
-               /// </summary>
-               public HttpStatusCode GetContent( string method,
-                                                 Uri requestUri,
-                                                 Dictionary< string, string > param,
-                                                 List< KeyValuePair< string, IMediaItem > > binary, 
-                                                 ref string content,
-                                                 Dictionary< string, string > headerInfo,
-                                                 CallbackDelegate callback )
-               {
-                       // 認証済かチェック
-                       if ( string.IsNullOrEmpty( token ) )
-                               return HttpStatusCode.Unauthorized;
-
-                       HttpWebRequest webReq = this.CreateRequest( method, requestUri, param, binary );
-                       // OAuth認証ヘッダを付加
-                       this.AppendOAuthInfo( webReq, null, token, tokenSecret );
-
-                       HttpStatusCode code;
-                       if ( content == null )
-                               code = this.GetResponse( webReq, headerInfo );
-                       else
-                               code = this.GetResponse( webReq, out content, headerInfo );
-
-                       if ( callback != null )
-                       {
-                               StackFrame frame = new StackFrame( 1 );
-                               callback( frame.GetMethod().Name, code, headerInfo, content );
-                       }
-                       return code;
-               }
-
-               /// <summary>
-               /// OAuth認証で指定のURLとHTTP通信を行い、ストリームを返す
-               /// </summary>
-               /// <param name="method">HTTP通信メソッド(GET/HEAD/POST/PUT/DELETE)</param>
-               /// <param name="requestUri">通信先URI</param>
-               /// <param name="param">GET時のクエリ、またはPOST時のエンティティボディ</param>
-               /// <param name="content">[OUT]HTTP応答のボディストリーム</param>
-               /// <returns>HTTP応答のステータスコード</returns>
-               public HttpStatusCode GetContent( string method,
-                                                 Uri requestUri,
-                                                 Dictionary< string, string > param,
-                                                 ref Stream content,
-                                                 string userAgent )
-               {
-                       // 認証済かチェック
-                       if ( string.IsNullOrEmpty( token ) )
-                               return HttpStatusCode.Unauthorized;
-
-                       this.RequestAbort();
-                       this.streamReq = this.CreateRequest( method, requestUri, param );
-                       // User-Agent指定がある場合は付加
-                       if ( !string.IsNullOrEmpty( userAgent ) )
-                               this.streamReq.UserAgent = userAgent;
-
-                       // OAuth認証ヘッダを付加
-                       this.AppendOAuthInfo( this.streamReq, param, token, tokenSecret );
-
-                       try
-                       {
-                               HttpWebResponse webRes = (HttpWebResponse)this.streamReq.GetResponse();
-                               content = webRes.GetResponseStream();
-                               return webRes.StatusCode;
-                       }
-                       catch ( WebException ex )
-                       {
-                               if ( ex.Status == WebExceptionStatus.ProtocolError )
-                               {
-                                       HttpWebResponse res = (HttpWebResponse)ex.Response;
-                                       return res.StatusCode;
-                               }
-                               throw;
-                       }
-               }
-
-               public void RequestAbort()
-               {
-                       try
-                       {
-                               if ( this.streamReq != null )
-                               {
-                                       this.streamReq.Abort();
-                                       this.streamReq = null;
-                               }
-                       }
-                       catch ( Exception ) {}
-               }
-
-               #region "OAuth認証用ヘッダ作成・付加処理"
-               /// <summary>
-               /// HTTPリクエストにOAuth関連ヘッダを追加
-               /// </summary>
-               /// <param name="webRequest">追加対象のHTTPリクエスト</param>
-               /// <param name="query">OAuth追加情報+クエリ or POSTデータ</param>
-               /// <param name="token">アクセストークン、もしくはリクエストトークン。未取得なら空文字列</param>
-               /// <param name="tokenSecret">アクセストークンシークレット。認証処理では空文字列</param>
-               protected virtual void AppendOAuthInfo( HttpWebRequest webRequest, Dictionary< string, string > query, string token, string tokenSecret )
-               {
-                       var credential = OAuthUtility.CreateAuthorization( webRequest.Method, webRequest.RequestUri, query,
-                               this.consumerKey, this.consumerSecret, token, tokenSecret );
-
-                       webRequest.Headers.Add( HttpRequestHeader.Authorization, credential );
-               }
-               #endregion // OAuth認証用ヘッダ作成・付加処理
-
-               /// <summary>
-               /// 初期化。各種トークンの設定とユーザー識別情報設定
-               /// </summary>
-               /// <param name="consumerKey">コンシューマー鍵</param>
-               /// <param name="consumerSecret">コンシューマー秘密鍵</param>
-               /// <param name="accessToken">アクセストークン</param>
-               /// <param name="accessTokenSecret">アクセストークン秘密鍵</param>
-               public void Initialize( string consumerKey, string consumerSecret,
-                                       string accessToken, string accessTokenSecret )
-               {
-                       this.consumerKey = consumerKey;
-                       this.consumerSecret = consumerSecret;
-                       this.token = accessToken;
-                       this.tokenSecret = accessTokenSecret;
-               }
-
-               /// <summary>
-               /// 初期化。各種トークンの設定とユーザー識別情報設定
-               /// </summary>
-               /// <param name="consumerKey">コンシューマー鍵</param>
-               /// <param name="consumerSecret">コンシューマー秘密鍵</param>
-               /// <param name="accessToken">アクセストークン</param>
-               /// <param name="accessTokenSecret">アクセストークン秘密鍵</param>
-               /// <param name="username">認証済みユーザー名</param>
-               public void Initialize( string consumerKey, string consumerSecret,
-                                       string accessToken, string accessTokenSecret,
-                                       string username, long userId )
-               {
-                       this.Initialize( consumerKey, consumerSecret, accessToken, accessTokenSecret );
-                       this.authorizedUsername = username;
-                       this.authorizedUserId = userId;
-               }
-
-               /// <summary>
-               /// アクセストークン
-               /// </summary>
-               public string AccessToken
-               {
-                       get { return this.token; }
-               }
-
-               /// <summary>
-               /// アクセストークン秘密鍵
-               /// </summary>
-               public string AccessTokenSecret
-               {
-                       get { return this.tokenSecret; }
-               }
-
-               /// <summary>
-               /// 認証済みユーザー名
-               /// </summary>
-               public string AuthUsername
-               {
-                       get { return this.authorizedUsername; }
-               }
-
-               /// <summary>
-               /// 認証済みユーザーId
-               /// </summary>
-               public long AuthUserId
-               {
-                       get { return this.authorizedUserId; }
-                       set { this.authorizedUserId = value; }
-               }
-       }
-}
diff --git a/OpenTween/Connection/HttpOAuthApiProxy.cs b/OpenTween/Connection/HttpOAuthApiProxy.cs
deleted file mode 100644 (file)
index ca463af..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-// OpenTween - Client of Twitter
-// Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
-//           (c) 2008-2011 Moz (@syo68k)
-//           (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
-//           (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
-//           (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
-//           (c) 2011      kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
-// All rights reserved.
-// 
-// This file is part of OpenTween.
-// 
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General public License as published by the Free
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-// 
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General public License
-// for more details. 
-// 
-// You should have received a copy of the GNU General public License along
-// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
-// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
-// Boston, MA 02110-1301, USA.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Text;
-using System.Security.Cryptography;
-using OpenTween.Connection;
-
-namespace OpenTween
-{
-    public class HttpOAuthApiProxy : HttpConnectionOAuth
-    {
-        private const string _apiHost = "api.twitter.com";
-        private static string _proxyHost = "";
-
-        public static string ProxyHost
-        {
-            get { return _proxyHost; }
-            set
-            {
-                if (string.IsNullOrEmpty(value) || value == _apiHost)
-                    _proxyHost = "";
-                else
-                    _proxyHost = value;
-            }
-        }
-
-        protected override void AppendOAuthInfo(HttpWebRequest webRequest, Dictionary<string, string> query,
-            string token, string tokenSecret)
-        {
-            var requestUri = webRequest.RequestUri;
-
-            // 本来のアクセス先URLに再設定(api.twitter.com固定)
-            if (!string.IsNullOrEmpty(_proxyHost) && requestUri.Host == _proxyHost)
-            {
-                var rewriteUriStr = requestUri.GetLeftPart(UriPartial.Scheme) + _proxyHost + requestUri.PathAndQuery;
-                requestUri = new Uri(rewriteUriStr);
-            }
-
-            var credential = OAuthUtility.CreateAuthorization(webRequest.Method, requestUri, query,
-                this.consumerKey, this.consumerSecret, token, tokenSecret);
-
-            webRequest.Headers.Add(HttpRequestHeader.Authorization, credential);
-        }
-
-    }
-}
diff --git a/OpenTween/Connection/HttpTwitter.cs b/OpenTween/Connection/HttpTwitter.cs
deleted file mode 100644 (file)
index f86498e..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-// OpenTween - Client of Twitter
-// Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
-//           (c) 2008-2011 Moz (@syo68k)
-//           (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
-//           (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
-//           (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
-//           (c) 2011      kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
-// All rights reserved.
-// 
-// This file is part of OpenTween.
-// 
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General public License as published by the Free
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-// 
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General public License
-// for more details. 
-// 
-// You should have received a copy of the GNU General public License along
-// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
-// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
-// Boston, MA 02110-1301, USA.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Net;
-using System.IO;
-
-namespace OpenTween
-{
-    public class HttpTwitter : ICloneable
-    {
-        private const string PostMethod = "POST";
-        private const string GetMethod = "GET";
-
-        private IHttpConnection httpCon; //HttpConnectionApi or HttpConnectionOAuth
-
-        private enum AuthMethod
-        {
-            OAuth,
-            Basic,
-        }
-        private AuthMethod connectionType = AuthMethod.Basic;
-
-        private static string tk = "";
-        private static string tks = "";
-        private static string un = "";
-
-        public void Initialize(string accessToken,
-                                        string accessTokenSecret,
-                                        string username,
-                                        long userId)
-        {
-            //for OAuth
-            HttpOAuthApiProxy con = new HttpOAuthApiProxy();
-            if (tk != accessToken || tks != accessTokenSecret ||
-                    un != username || connectionType != AuthMethod.OAuth)
-            {
-                // 以前の認証状態よりひとつでも変化があったらhttpヘッダより読み取ったカウントは初期化
-                tk = accessToken;
-                tks = accessTokenSecret;
-                un = username;
-            }
-            con.Initialize(ApplicationSettings.TwitterConsumerKey, ApplicationSettings.TwitterConsumerSecret, accessToken, accessTokenSecret, username, userId);
-            con.CacheEnabled = false;
-            httpCon = con;
-            connectionType = AuthMethod.OAuth;
-        }
-
-        public string AccessToken
-        {
-            get
-            {
-                return ((HttpConnectionOAuth)httpCon)?.AccessToken ?? "";
-            }
-        }
-
-        public string AccessTokenSecret
-        {
-            get
-            {
-                return ((HttpConnectionOAuth)httpCon)?.AccessTokenSecret ?? "";
-            }
-        }
-
-        public string AuthenticatedUsername
-        {
-            get
-            {
-                return httpCon?.AuthUsername ?? "";
-            }
-        }
-
-        public long AuthenticatedUserId
-        {
-            get
-            {
-                return httpCon?.AuthUserId ?? 0;
-            }
-            set
-            {
-                if (httpCon != null)
-                    httpCon.AuthUserId = value;
-            }
-        }
-
-        public string Password
-        {
-            get
-            {
-                return "";
-            }
-        }
-
-        public void ClearAuthInfo()
-        {
-            this.Initialize("", "", "", 0);
-        }
-
-        public HttpStatusCode SavedSearches(ref string content)
-        {
-            return httpCon.GetContent(GetMethod,
-                this.CreateTwitterUri("/1.1/saved_searches/list.json"),
-                null,
-                ref content,
-                this.CreateRatelimitHeadersDict(),
-                this.CreateApiCalllback("/saved_searches/list"));
-        }
-
-        public HttpStatusCode Statusid_retweeted_by_ids(long statusid, int? count, int? page, ref string content)
-        {
-            Dictionary<string, string> param = new Dictionary<string, string>();
-            if (count != null)
-                param.Add("count", count.ToString());
-            if (page != null)
-                param.Add("page", page.ToString());
-
-            param.Add("id", statusid.ToString());
-
-            return httpCon.GetContent(GetMethod,
-                this.CreateTwitterUri("/1.1/statuses/retweeters/ids.json"),
-                param,
-                ref content,
-                this.CreateRatelimitHeadersDict(),
-                this.CreateApiCalllback("/statuses/retweeters/ids"));
-        }
-
-        #region Proxy API
-        private static string _twitterUrl = "api.twitter.com";
-        private static string _twitterUserStreamUrl = "userstream.twitter.com";
-        private static string _twitterStreamUrl = "stream.twitter.com";
-        private static string _twitterUploadUrl = "upload.twitter.com";
-
-        private Uri CreateTwitterUri(string path)
-        {
-            return new Uri(string.Format("{0}{1}{2}", "https://", _twitterUrl, path));
-        }
-
-        private Uri CreateTwitterUserStreamUri(string path)
-        {
-            return new Uri(string.Format("{0}{1}{2}", "https://", _twitterUserStreamUrl, path));
-        }
-
-        private Uri CreateTwitterStreamUri(string path)
-        {
-            return new Uri(string.Format("{0}{1}{2}", "http://", _twitterStreamUrl, path));
-        }
-
-        private Uri CreateTwitterUploadUri(string path)
-        {
-            return new Uri(string.Format("{0}{1}{2}", "https://", _twitterUploadUrl, path));
-        }
-
-        public static string TwitterUrl
-        {
-            get { return _twitterUrl; }
-            set
-            {
-                _twitterUrl = value;
-                HttpOAuthApiProxy.ProxyHost = value;
-            }
-        }
-        #endregion
-
-        private Dictionary<string, string> CreateRatelimitHeadersDict()
-        {
-            return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
-            {
-                ["X-Access-Level"] = "",
-                ["X-RateLimit-Limit"] = "",
-                ["X-RateLimit-Remaining"] = "",
-                ["X-RateLimit-Reset"] = "",
-                ["X-Rate-Limit-Limit"] = "",
-                ["X-Rate-Limit-Remaining"] = "",
-                ["X-Rate-Limit-Reset"] = "",
-                ["X-MediaRateLimit-Limit"] = "",
-                ["X-MediaRateLimit-Remaining"] = "",
-                ["X-MediaRateLimit-Reset"] = "",
-            };
-        }
-
-        private CallbackDelegate CreateApiCalllback(string endpointName)
-        {
-            return (sender, code, headerInfo, content) =>
-            {
-                if (code < HttpStatusCode.InternalServerError)
-                    MyCommon.TwitterApiInfo.UpdateFromHeader(headerInfo, endpointName);
-            };
-        }
-
-        public HttpStatusCode FilterStream(ref Stream content,
-                                           string trackwords,
-                                           string userAgent)
-        {
-            //文中の日本語キーワードに反応せず、使えない(スペースで分かち書きしてないと反応しない)
-            Dictionary<string, string> param = new Dictionary<string, string>();
-
-            if (!string.IsNullOrEmpty(trackwords))
-                param.Add("track", string.Join(",", trackwords.Split(" ".ToCharArray())));
-
-            return httpCon.GetContent(PostMethod,
-                this.CreateTwitterStreamUri("/1.1/statuses/filter.json"),
-                param,
-                ref content,
-                userAgent);
-        }
-
-        public void RequestAbort()
-        {
-            httpCon.RequestAbort();
-        }
-
-        public object Clone()
-        {
-            HttpTwitter myCopy = new HttpTwitter();
-            myCopy.Initialize(this.AccessToken, this.AccessTokenSecret, this.AuthenticatedUsername, this.AuthenticatedUserId);
-            return myCopy;
-        }
-    }
-}
diff --git a/OpenTween/Connection/IHttpConnection.cs b/OpenTween/Connection/IHttpConnection.cs
deleted file mode 100644 (file)
index f286d27..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// OpenTween - Client of Twitter
-// Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
-//           (c) 2008-2011 Moz (@syo68k)
-//           (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
-//           (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
-//           (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
-//           (c) 2011      Egtra (@egtra) <http://dev.activebasic.com/egtra/>
-// All rights reserved.
-//
-// This file is part of OpenTween.
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program. If not, see <http://www.gnu.org/licenses/>, or write to
-// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
-// Boston, MA 02110-1301, USA.
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Net;
-
-namespace OpenTween
-{
-    public interface IHttpConnection
-    {
-        HttpStatusCode GetContent(string method,
-                Uri requestUri,
-                Dictionary<string, string> param,
-                ref Stream content,
-                string userAgent);
-
-        HttpStatusCode GetContent(string method,
-                Uri requestUri,
-                Dictionary<string, string> param,
-                ref string content,
-                Dictionary<string, string> headerInfo,
-                CallbackDelegate callback);
-
-        HttpStatusCode GetContent(string method,
-                Uri requestUri,
-                Dictionary<string, string> param,
-                List<KeyValuePair<string, IMediaItem>> binary,
-                ref string content,
-                Dictionary<string, string> headerInfo,
-                CallbackDelegate callback);
-
-        void RequestAbort();
-
-        string AuthUsername { get; }
-        long AuthUserId { get; set; }
-    }
-
-    /// <summary>
-    /// APIメソッドの処理が終了し呼び出し元へ戻る直前に呼ばれるデリゲート
-    /// </summary>
-    /// <param name="sender">メソッド名</param>
-    /// <param name="code">APIメソッドの返したHTTPステータスコード</param>
-    /// <param name="headerInfo">HTTPヘッダー情報</param>
-    /// <param name="content">APIメソッドの処理結果</param>
-    /// <remarks>contentはNothingになることがあるのでチェックを必ず行うこと</remarks>
-    public delegate void CallbackDelegate(object sender, HttpStatusCode code, IDictionary<string, string> headerInfo, string content);
-}
index 244f7b6..e4a8bd9 100644 (file)
       <DependentUpon>AuthDialog.cs</DependentUpon>
     </Compile>
     <Compile Include="Bing.cs" />
-    <Compile Include="Connection\HttpOAuthApiProxy.cs" />
-    <Compile Include="Connection\HttpTwitter.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Connection\HttpVarious.cs" />
-    <Compile Include="Connection\HttpConnectionOAuth.cs" />
     <Compile Include="Connection\IApiConnection.cs" />
-    <Compile Include="Connection\IHttpConnection.cs" />
     <Compile Include="Connection\IMediaUploadService.cs" />
     <Compile Include="Connection\imgly.cs" />
     <Compile Include="Connection\Imgur.cs" />
index bb95d6a..b7f63e5 100644 (file)
@@ -7911,7 +7911,6 @@ namespace OpenTween
             {
                 _cfgCommon.UserName = tw.Username;
                 _cfgCommon.UserId = tw.UserId;
-                _cfgCommon.Password = tw.Password;
                 _cfgCommon.Token = tw.AccessToken;
                 _cfgCommon.TokenSecret = tw.AccessTokenSecret;
 
index 37eb73d..1f68331 100644 (file)
@@ -168,8 +168,6 @@ namespace OpenTween
 
         //private FavoriteQueue favQueue;
 
-        private HttpTwitter twCon = new HttpTwitter();
-
         //private List<PostClass> _deletemessages = new List<PostClass>();
 
         public Twitter() : this(new TwitterApi())
@@ -199,7 +197,6 @@ namespace OpenTween
         {
             Twitter.AccountState = MyCommon.ACCOUNT_STATE.Invalid;
             this.ResetApiStatus();
-            twCon.ClearAuthInfo();
         }
 
         [Obsolete]
@@ -220,7 +217,6 @@ namespace OpenTween
             var user = await this.Api.AccountVerifyCredentials()
                 .ConfigureAwait(false);
 
-            this.twCon.AuthenticatedUserId = user.Id;
             this.UpdateUserStats(user);
         }
 
@@ -233,7 +229,6 @@ namespace OpenTween
             }
             this.ResetApiStatus();
             this.Api.Initialize(token, tokenSecret, userId, username);
-            twCon.Initialize(token, tokenSecret, username, userId);
             _uname = username.ToLowerInvariant();
             if (SettingCommon.Instance.UserstreamStartup) this.ReconnectUserStream();
         }
@@ -530,28 +525,10 @@ namespace OpenTween
         }
 
         public string Username
-        {
-            get
-            {
-                return twCon.AuthenticatedUsername;
-            }
-        }
+            => this.Api.CurrentScreenName;
 
         public long UserId
-        {
-            get
-            {
-                return twCon.AuthenticatedUserId;
-            }
-        }
-
-        public string Password
-        {
-            get
-            {
-                return twCon.Password;
-            }
-        }
+            => this.Api.CurrentUserId;
 
         private static MyCommon.ACCOUNT_STATE _accountState = MyCommon.ACCOUNT_STATE.Valid;
         public static MyCommon.ACCOUNT_STATE AccountState
@@ -1381,7 +1358,7 @@ namespace OpenTween
                     TwitterUser user;
                     if (gType == MyCommon.WORKERTYPE.UserStream)
                     {
-                        if (twCon.AuthenticatedUsername.Equals(message.Recipient.ScreenName, StringComparison.CurrentCultureIgnoreCase))
+                        if (this.Api.CurrentUserId == message.Recipient.Id)
                         {
                             user = message.Sender;
                             post.IsMe = false;
@@ -1819,20 +1796,10 @@ namespace OpenTween
         }
 
         public string AccessToken
-        {
-            get
-            {
-                return twCon.AccessToken;
-            }
-        }
+            => ((TwitterApiConnection)this.Api.Connection).AccessToken;
 
         public string AccessTokenSecret
-        {
-            get
-            {
-                return twCon.AccessTokenSecret;
-            }
-        }
+            => ((TwitterApiConnection)this.Api.Connection).AccessSecret;
 
         private void CheckAccountState()
         {