コード例 #1
0
 internal StreamActivityListener(Contact c, StreamTubeChannel tube)
     : base(c, tube)
 {
     this.tube = tube;
 }
コード例 #2
0
        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 ();
                }
            }
        }