Inheritance: Squishy.Irc.Dcc.DccClient
Beispiel #1
0
 internal void ChatClosedNotify(DccChatClient client)
 {
     if (ChatClosed != null)
     {
         ChatClosed(client);
     }
 }
Beispiel #2
0
 internal void ChatFailedNotify(DccChatClient client, Exception ex)
 {
     if (ChatFailed != null)
     {
         ChatFailed(client, ex);
     }
 }
Beispiel #3
0
 internal void ChatEstablishedNotify(DccChatClient client)
 {
     if (ChatEstablished != null)
     {
         ChatEstablished(client);
     }
 }
Beispiel #4
0
 internal void RemoveChatClient(DccChatClient client)
 {
     if (chatCons.ContainsKey(client.User))
     {
         chatCons.Remove(client.User);
     }
 }
Beispiel #5
0
        internal void ChatMessageReceivedNotify(DccChatClient client, StringStream text)
        {
            if (ChatMessageReceived != null)
            {
                ChatMessageReceived(client, text);
            }

            if (m_irc.TriggersCommand(client.User, null, text))
            {
                m_irc.CommandHandler.Execute(new DccChatCmdTrigger(text, client.User));
            }
        }
Beispiel #6
0
 internal void AddChatClient(DccChatClient client)
 {
     if (chatCons.ContainsKey(client.User))
     {
         throw new ArgumentException(
                   "Chat already has been established",
                   "DccChatClient with " + client.User
                   );
     }
     else
     {
         chatCons.Add(client.User, client);
     }
 }
Beispiel #7
0
        /// <summary>
        /// Sends a Dcc Chat request to the specified target and establishs a DccChatClient and a
        /// corresponding Listener with a custom timeout to listen for the incoming Chat Session.
        /// </summary>
        /// <param name="target">The nick of the user who should receive a file.</param>
        /// <param name="timeout">Specifies how long the listener should wait for an incoming receiver.</param>
        public DccChatClient Chat(string target, TimeSpan timeout, int port)
        {
            IrcUser user = m_irc.GetUser(target);

            if (user == null)
            {
                user = new IrcUser(m_irc, target);
            }
            var client = new DccChatClient(this, user, timeout, port);

            m_irc.CommandHandler.DccRequest(target,
                                            string.Format("CHAT \"chat\" {0} {1}",
                                                          Util.GetTcpAddress(Util.ExternalAddress),
                                                          client.Listener.LocalEndPoint.Port));
            return(client);
        }
Beispiel #8
0
 private void HandleChat(IrcUser user, string[] args)
 {
     try
     {
         long ip       = Convert.ToInt64(args[1]);
         int  port     = Convert.ToInt32(args[2]);
         var  endPoint = new IPEndPoint(Util.GetTcpAddress(ip), port);
         var  chatArgs = new DccChatArgs(user, endPoint);
         ChatRequestedNotify(chatArgs);
         if (chatArgs.Accept)
         {
             var client = new DccChatClient(this, user, endPoint);
         }
     }
     catch (Exception)
     {
         HandleInvalid(user, "CHAT", args);
     }
 }
Beispiel #9
0
 private void HandleChat(IrcUser user, string[] args)
 {
     try
     {
         long ip = Convert.ToInt64(args[1]);
         int port = Convert.ToInt32(args[2]);
         var endPoint = new IPEndPoint(Util.GetTcpAddress(ip), port);
         var chatArgs = new DccChatArgs(user, endPoint);
         ChatRequestedNotify(chatArgs);
         if (chatArgs.Accept)
         {
             var client = new DccChatClient(this, user, endPoint);
         }
     }
     catch (Exception)
     {
         HandleInvalid(user, "CHAT", args);
     }
 }
Beispiel #10
0
 internal void RemoveChatClient(DccChatClient client)
 {
     if (chatCons.ContainsKey(client.User))
         chatCons.Remove(client.User);
 }
Beispiel #11
0
        internal void ChatMessageReceivedNotify(DccChatClient client, StringStream text)
        {
            if (ChatMessageReceived != null)
                ChatMessageReceived(client, text);

            if (m_irc.TriggersCommand(client.User, null, text))
            {
                m_irc.CommandHandler.Execute(new DccChatCmdTrigger(text, client.User));
            }
        }
Beispiel #12
0
 internal void ChatFailedNotify(DccChatClient client, Exception ex)
 {
     if (ChatFailed != null)
         ChatFailed(client, ex);
 }
Beispiel #13
0
 internal void ChatEstablishedNotify(DccChatClient client)
 {
     if (ChatEstablished != null)
         ChatEstablished(client);
 }
Beispiel #14
0
 internal void ChatClosedNotify(DccChatClient client)
 {
     if (ChatClosed != null)
         ChatClosed(client);
 }
Beispiel #15
0
 internal void AddChatClient(DccChatClient client)
 {
     if (chatCons.ContainsKey(client.User))
         throw new ArgumentException(
             "Chat already has been established",
             "DccChatClient with " + client.User
             );
     else
         chatCons.Add(client.User, client);
 }
Beispiel #16
0
 /// <summary>
 /// Sends a Dcc Chat request to the specified target and establishs a DccChatClient and a 
 /// corresponding Listener with a custom timeout to listen for the incoming Chat Session.
 /// </summary>
 /// <param name="target">The nick of the user who should receive a file.</param>
 /// <param name="timeout">Specifies how long the listener should wait for an incoming receiver.</param>
 public DccChatClient Chat(string target, TimeSpan timeout, int port)
 {
     IrcUser user = m_irc.GetUser(target);
     if (user == null)
         user = new IrcUser(m_irc, target);
     var client = new DccChatClient(this, user, timeout, port);
     m_irc.CommandHandler.DccRequest(target,
                               string.Format("CHAT \"chat\" {0} {1}",
                                             Util.GetTcpAddress(Util.ExternalAddress),
                                             client.Listener.LocalEndPoint.Port));
     return client;
 }