Changeset 383

Show
Ignore:
Timestamp:
05/15/08 03:33:19 (6 months ago)
Author:
tomoyo
Message:

ソケットエラーを表示するようにした。

Location:
TwitterIrcGateway/branches/im-support/TwitterIrcGatewayCore
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • TwitterIrcGateway/branches/im-support/TwitterIrcGatewayCore/Session.cs

    r382 r383  
    941941            _twitterIm.Logined += new EventHandler(twitterIm_Logined); 
    942942            _twitterIm.AuthErrored += new EventHandler(twitterIm_AuthErrored); 
     943            _twitterIm.SocketErrorHandled += new EventHandler<TwitterIMService.ErrorEventArgs>(twitterIm_SocketErrorHandled); 
    943944            _twitterIm.Open(); 
     945        } 
     946 
     947        void twitterIm_SocketErrorHandled(object sender, TwitterIMService.ErrorEventArgs e) 
     948        { 
     949            SendTwitterGatewayServerMessage("インスタントメッセージングサービスの接続でエラーが発生しました: " + e.Exception.Message); 
    944950        } 
    945951        void twitterIm_Logined(object sender, EventArgs e) 
  • TwitterIrcGateway/branches/im-support/TwitterIrcGatewayCore/TwitterIMService.cs

    r382 r383  
    1616        public event EventHandler<StatusUpdateReceivedEventArgs> StatusUpdateReceived; 
    1717        public event EventHandler Logined; 
    18         public event EventHandler ErrorHandled; 
     18        public event EventHandler<ErrorEventArgs> ErrorHandled; 
     19        public event EventHandler<ErrorEventArgs> SocketErrorHandled; 
    1920        public event EventHandler AuthErrored; 
    2021         
     
    3233            _xmppConnection.OnError += new ErrorHandler(xmppConnection_OnError); 
    3334            _xmppConnection.OnMessage += new agsXMPP.protocol.client.MessageHandler(xmppConnection_OnMessage); 
     35            _xmppConnection.OnSocketError += new ErrorHandler(xmppConnection_OnSocketError); 
    3436        } 
    3537 
     
    9294        } 
    9395 
     96        void xmppConnection_OnSocketError(object sender, Exception ex) 
     97        { 
     98            OnSocketErrorHandled(ex); 
     99        } 
     100 
    94101        void xmppConnection_OnError(object sender, Exception ex) 
    95102        { 
    96103            Trace.WriteLine(ex); 
     104            OnErrorHandled(ex); 
    97105        } 
    98106        #endregion 
     
    104112                Logined(this, EventArgs.Empty); 
    105113        } 
    106         private void OnErrorHandled() 
     114        private void OnErrorHandled(Exception ex) 
    107115        { 
    108116            if (ErrorHandled != null) 
    109                 ErrorHandled(this, EventArgs.Empty); 
     117                ErrorHandled(this, new ErrorEventArgs(ex)); 
     118        } 
     119        private void OnSocketErrorHandled(Exception ex) 
     120        { 
     121            if (SocketErrorHandled != null) 
     122                SocketErrorHandled(this, new ErrorEventArgs(ex)); 
    110123        } 
    111124        private void OnAuthErrored() 
     
    118131            if (StatusUpdateReceived != null) 
    119132                StatusUpdateReceived(this, new StatusUpdateReceivedEventArgs(status)); 
     133        } 
     134 
     135        public class ErrorEventArgs : EventArgs 
     136        { 
     137            public Exception Exception { get; set; } 
     138 
     139            public ErrorEventArgs(Exception ex) 
     140            { 
     141                this.Exception = ex; 
     142            } 
    120143        } 
    121144