Exemplo n.º 1
0
        private void OnDCCPassive(IRCConnection connection, string nick, string host, string ip, string file, uint fileSize, uint filePos, bool resume, string id)
        {
            //passive dcc, open a listening socket and send out back to socket
            if (iceChatOptions.DCCFileIgnore)
                return;

            if (this.InvokeRequired)
            {
                ShowDCCPassiveAcceptDelegate s = new ShowDCCPassiveAcceptDelegate(OnDCCPassive);
                this.Invoke(s, new object[] { connection, nick, host, ip, file, fileSize, filePos, resume, id });
            }
            else
            {
                if (!iceChatOptions.DCCFileAutoAccept)
                {
                    //check if on System Tray
                    if (notifyIcon.Visible)
                        return;

                    //ask for the dcc file receive
                    FormDCCFileAccept dccAccept = new FormDCCFileAccept(connection, nick, host, "", ip, file, fileSize, filePos, resume,  id);
                    dccAccept.DCCFileAcceptResult += new FormDCCFileAccept.DCCFileAcceptDelegate(OnDCCPassiveAcceptResult);
                    dccAccept.StartPosition = FormStartPosition.CenterParent;
                    dccAccept.Show(FormMain.Instance);
                }
            }
        }
Exemplo n.º 2
0
        private void OnDCCFile(IRCConnection connection, string nick, string host, string port, string ip, string file, uint fileSize, uint filePos, bool resume)
        {
            if (iceChatOptions.DCCFileIgnore)
                return;

            if (this.InvokeRequired)
            {
                ShowDCCFileAcceptDelegate s = new ShowDCCFileAcceptDelegate(OnDCCFile);
                this.Invoke(s, new object[] { connection, nick, host, port, ip, file, fileSize, filePos, resume });
            }
            else
            {
                //check if we have disabled DCC Files, do we auto-accept or ask to allow

                if (!iceChatOptions.DCCFileAutoAccept && !resume)
                {
                    //check if on System Tray
                    if (notifyIcon.Visible)
                        return;

                    //ask for the dcc file receive
                    FormDCCFileAccept dccAccept = new FormDCCFileAccept(connection, nick, host, port, ip, file, fileSize, resume, filePos);
                    dccAccept.DCCFileAcceptResult += new FormDCCFileAccept.DCCFileAcceptDelegate(OnDCCFileAcceptResult);
                    dccAccept.StartPosition = FormStartPosition.CenterParent;
                    dccAccept.Show(FormMain.Instance);

                }
                else if (iceChatOptions.DCCFileAutoAccept)
                {
                    if (!mainTabControl.WindowExists(null, "DCC Files", IceTabPage.WindowType.DCCFile))
                        AddWindow(null, "DCC Files", IceTabPage.WindowType.DCCFile);

                    IceTabPage t = GetWindow(null, "DCC Files", IceTabPage.WindowType.DCCFile);
                    if (t != null)
                    {
                        if (!resume)
                            ((IceTabPageDCCFile)t).StartDCCFile(connection, nick, host, ip, port, file, fileSize);
                        else
                        {
                            ((IceTabPageDCCFile)t).ResumeDCCFile(connection, port, filePos);
                        }
                    }
                }
            }
        }