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 { //check if on System Tray if (!this.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(this); } }
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) { //System.Diagnostics.Debug.WriteLine("Show DCC Accept"); 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 (!this.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(this); } else if (iceChatOptions.DCCFileAutoAccept || resume == true) { if (!mainChannelBar.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); PluginArgs args = new PluginArgs(connection); args.Nick = nick; args.Host = host; args.fileName = file; args.filePos = 0; args.fileSize = fileSize; args.dccPort = port; args.dccIP = ip; foreach (Plugin p in loadedPlugins) { IceChatPlugin ipc = p as IceChatPlugin; if (ipc != null) { if (ipc.plugin.Enabled == true) ipc.plugin.DCCFileStart(args); } } } else { ((IceTabPageDCCFile)t).ResumeDCCFile(connection, port, filePos); PluginArgs args = new PluginArgs(connection); args.Nick = nick; args.Host = host; args.fileName = file; args.filePos = filePos; args.fileSize = fileSize; args.dccPort = port; args.dccIP = ip; foreach (Plugin p in loadedPlugins) { IceChatPlugin ipc = p as IceChatPlugin; if (ipc != null) { if (ipc.plugin.Enabled == true) ipc.plugin.DCCFileResume(args); } } } } } else if (resume) { System.Diagnostics.Debug.WriteLine("resume accept"); } } }