public void OnRecieveMessage( object source, IMReceivedArgs e )
        {
            if( e.chatmessagetype == ChatMessageType.PrivateMessage ) {
                OnServerRegistration( e.Sender, e.MessageText );
            }
            else if( e.chatmessagetype == ChatMessageType.Error ) {
                 LogFile.WriteLine( "Error: " + e.MessageText );
                Thread.Sleep( 10000 );
                Connect();
            }

            return;
        }
Beispiel #2
0
 void imimplementation_IMReceived( object source, IMReceivedArgs e )
 {
     Console.WriteLine( "queryserver, im received " + e.Sender + " " + e.MessageText );
     if (e.Sender == targetserver)
     {
         try
         {
             XmlCommands.Command command = XmlCommands.GetInstance().Decode( e.MessageText );
             if( command.GetType() == typeof( XmlCommands.ServerInfo ) )
             {
                 XmlCommands.ServerInfo serverinfo = command as XmlCommands.ServerInfo;
                 Console.WriteLine( "IRCQueryServer Got server response " + serverinfo );
                 callback( targetserver, serverinfo );
                 chat.IMReceived -= handler;
             }
         }
         catch( Exception ex )
         {
             LogFile.WriteLine( ex );
         }
     }
 }
Beispiel #3
0
        string MessageToDisplayLine( IMReceivedArgs e )
        {
            switch( e.chatmessagetype )
            {
                case ChatMessageType.Action:
                    return "*" + e.Sender + "* " + e.MessageText;

                case ChatMessageType.ChannelMessage:
                    return "<" + e.Sender + "> " + e.MessageText;

                case ChatMessageType.Error:
                    return e.MessageText;

                case ChatMessageType.Notice:
                    return "-" + e.Sender + "-" + e.MessageText;

                case ChatMessageType.PrivateMessage:
                    return "*" + e.Sender + "*" + e.MessageText;
            }
            return "";
        }
Beispiel #4
0
 //int numlines = 0;
 void MessageReceived( object source, IMReceivedArgs e )
 {
     string messagetodisplay = MessageToDisplayLine( e );
     LogFile.WriteLine("message received: " + messagetodisplay );
     AppendMessage( messagetodisplay );
 }