private bool SetSocketType() { IDictionary <uint, uint[]> supported_sockets = (IDictionary <uint, uint[]>)DBusUtility.GetProperty(BusType.Session, Connection.BusName, ObjectPath, Constants.CHANNEL_TYPE_FILETRANSFER, "AvailableSocketTypes"); bool supported = false; if (supported_sockets.ContainsKey((uint)SocketAddressType.Unix)) { supported = true; } // TODO commented out for now, since we can't use IPv4 until Mono 2.4 /* * else if (supported_sockets.ContainsKey ((uint)SocketAddressType.IPv4)) { * socket_type = SocketAddressType.IPv4; * supported = true; * } */ return(supported); }
public virtual void Announce(string message) { if (message == null) { throw new ArgumentNullException("message"); } try { foreach (Account account in locator.GetConnections()) { object obj = DBusUtility.GetProperty(account.BusType, Constants.ACCOUNTMANAGER_IFACE, account.AccountObjectPath, Constants.ACCOUNT_IFACE, "CurrentPresence"); SimplePresence presence = (SimplePresence)System.Convert.ChangeType(obj, typeof(SimplePresence)); presence.StatusMessage = message; DBusUtility.SetProperty(account.BusType, Constants.ACCOUNTMANAGER_IFACE, account.AccountObjectPath, Constants.ACCOUNT_IFACE, "RequestedPresence", presence); } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
protected void OnNewChannels (ChannelDetails[] channels) { if (chann_path != null) { return; } foreach (ChannelDetails c in channels) { ObjectPath object_path = c.Channel; string channel_type = (string) c.Properties[Constants.CHANNEL_IFACE + ".ChannelType"]; HandleType handle_type = (HandleType) c.Properties[Constants.CHANNEL_IFACE + ".TargetHandleType"]; uint target_handle = (uint) c.Properties[Constants.CHANNEL_IFACE + ".TargetHandle"]; Console.WriteLine ("NewChannel detected: object path {0}, channel_type {1}, handle_type {2}, target_handle {3}", object_path, channel_type, handle_type.ToString (), target_handle); initiator = (uint) DBusUtility.GetProperty (Connection.Bus, Connection.BusName, object_path.ToString (), Constants.CHANNEL_IFACE, "InitiatorHandle"); if (channel_type.Equals (ChannelType) && (target_handle == TargetHandle || initiator == TargetHandle)) { ChannPath = object_path.ToString (); ProcessNewChannel (c); return; } } }
private string GetConnectionObjectPath() { ObjectPath path = (ObjectPath)DBusUtility.GetProperty(BusType, Constants.ACCOUNTMANAGER_IFACE, AccountObjectPath, Constants.ACCOUNT_IFACE, "Connection"); return(path.ToString()); }
public Connection(string bus_name, string object_path, string account_id, string account_path) { this.AccountId = account_id; this.AccountObjectPath = account_path; this.BusName = bus_name; this.ObjectPath = object_path; this.conn = DBusUtility.GetProxy <IConnection> (bus, bus_name, object_path); self_handle = (uint)DBusUtility.GetProperty(bus, bus_name, object_path, Constants.CONNECTION_IFACE, "SelfHandle"); Initialize(); }
private void AddConnections() { ObjectPath[] paths = (ObjectPath[])DBusUtility.GetProperty(bus, Constants.ACCOUNTMANAGER_IFACE, Constants.ACCOUNTMANAGER_PATH, Constants.ACCOUNTMANAGER_IFACE, "ValidAccounts"); foreach (ObjectPath p in paths) { Account account = new Account(p.ToString()); account.ConnectionStatusChanged += delegate(object sender, ConnectionStatusEventArgs args) { OnConnectionStatusChanged(args); }; connections.Add(p.ToString(), account); } }
private void Initialize() { iaccount = DBusUtility.GetProxy <IAccount> (BusType.Session, Constants.ACCOUNTMANAGER_IFACE, AccountObjectPath); iaccount.AccountPropertyChanged += OnAccountPropertyChanged; ObjectPath = GetConnectionObjectPath(); connected = !ObjectPath.Equals("/"); AccountId = (string)DBusUtility.GetProperty(BusType, Constants.ACCOUNTMANAGER_IFACE, AccountObjectPath, Constants.ACCOUNT_IFACE, "NormalizedName"); }
protected void OnNewChannels(ChannelDetails[] channels) { foreach (ChannelDetails c in channels) { string object_path = c.Channel.ToString(); string channel_type = (string)c.Properties[Constants.CHANNEL_IFACE + ".ChannelType"]; HandleType handle_type = (HandleType)c.Properties[Constants.CHANNEL_IFACE + ".TargetHandleType"]; uint target_handle = (uint)c.Properties[Constants.CHANNEL_IFACE + ".TargetHandle"]; if (channel_type.Equals(ChannelType) && CanProcess(c)) { Console.WriteLine("NewChannel detected: object path {0}, channel_type {1}, handle_type {2}, target_handle {3}", object_path, channel_type, handle_type.ToString(), target_handle); uint initiator_handle = (uint)DBusUtility.GetProperty(Connection.Bus, Connection.BusName, object_path, Constants.CHANNEL_IFACE, "InitiatorHandle"); ProcessNewChannel(object_path, initiator_handle, target_handle, c); return; } } }