protected override void ProcessNewChannel(string object_path, uint initiator_handle, uint target_handle, ChannelDetails c) { string service_name = (string)c.Properties[Constants.CHANNEL_TYPE_DBUSTUBE + ".ServiceName"]; Contact contact = Connection.Roster.GetContact(target_handle); DBusTubeChannel tube = null; try { tube = new DBusTubeChannel(this.Connection, object_path, initiator_handle, target_handle, service_name); DBusActivity activity = new DBusActivity(contact, tube); DispatchManager dm = Connection.DispatchManager; dm.Add(contact, activity.Service, activity, false); } catch (Exception e) { Console.WriteLine(e.ToString()); if (tube != null) { tube.Dispose(); } } }
protected override void ProcessNewChannel(string object_path, uint initiator_handle, uint target_handle, ChannelDetails c) { Console.WriteLine("Processing new channel for file transfer"); string filename = (string)c.Properties[Constants.CHANNEL_TYPE_FILETRANSFER + ".Filename"]; string content_type = (string)c.Properties[Constants.CHANNEL_TYPE_FILETRANSFER + ".ContentType"]; ulong size = (ulong)c.Properties[Constants.CHANNEL_TYPE_FILETRANSFER + ".Size"]; Contact contact = Connection.Roster.GetContact(target_handle); FileTransferChannel ft = null; FileTransfer transfer = null; try { ft = new FileTransferChannel(this.Connection, object_path, initiator_handle, target_handle, filename, content_type, (long)size); if (initiator_handle != Connection.SelfHandle) { transfer = new IncomingFileTransfer(contact, ft); } else { transfer = new OutgoingFileTransfer(contact, ft); } if (transfer != null) { DispatchManager dm = Connection.DispatchManager; dm.Add(contact, transfer.OriginalFilename, transfer); } } catch (Exception e) { Console.WriteLine(e.ToString()); if (transfer != null) { transfer.Dispose(); } else if (ft != null) { ft.Dispose(); } } }
protected override void ProcessNewChannel(string object_path, uint initiator_handle, uint target_handle, ChannelDetails c) { string service_name = (string)c.Properties[Constants.CHANNEL_TYPE_STREAMTUBE + ".Service"]; Contact contact = Connection.Roster.GetContact(target_handle); StreamTubeChannel tube = null; Activity activity = null; try { tube = new StreamTubeChannel(this.Connection, object_path, initiator_handle, target_handle, service_name); if (initiator_handle == Connection.SelfHandle) { tube.ServerAddress = Connection.SupportedChannels.GetChannelInfo <StreamTubeChannelInfo> (service_name).Address; activity = new StreamActivityListener(contact, tube); } else { activity = new StreamActivity(contact, tube); } if (activity != null) { DispatchManager dm = Connection.DispatchManager; dm.Add(contact, activity.Service, activity); } } catch (Exception e) { Console.WriteLine(e.ToString()); if (activity != null) { activity.Dispose(); } else if (tube != null) { tube.Dispose(); } } }