public ConnectionLocator() { account_manager = DBusUtility.GetProxy <IAccountManager> (bus, Constants.ACCOUNTMANAGER_IFACE, Constants.ACCOUNTMANAGER_PATH); Initialize(); }
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()); } }
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); }
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(); }
protected virtual void OnContactListChannelReady(object sender, EventArgs args) { uint [] contacts = contact_list.GetContacts(); //Log.DebugFormat ("Account {0} has {1} contacts", conn.AccountId, contacts.Length); presence = DBusUtility.GetProxy <ISimplePresence> (conn.Bus, conn.BusName, conn.ObjectPath); GetPresenceInfo(contacts); presence.PresencesChanged += OnPresencesChanged; state = RosterState.Loaded; OnRosterStateChanged(new RosterEventArgs(state)); }
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); } }
protected virtual void Initialize() { requests = DBusUtility.GetProxy <IRequests> (bus, bus_name, object_path); capabilities = DBusUtility.GetProxy <IContactCapabilities> (bus, bus_name, object_path); conn.StatusChanged += OnStatusChanged; conn.SelfHandleChanged += OnSelfHandleChanged; LoadCapabilities(); dispatch_manager = new DispatchManager(this); CreateRoster(); }
public void Close () { try { if (chann_path != null) { IChannel channel = DBusUtility.GetProxy <IChannel> (conn.Bus, conn.BusName, chann_path); // some channels can't be closed, so catch exception and log // also, channel might be cleaned up by Telepathy already, so attempting to close // may result in an exception channel.Close (); channel = null; chann_path = null; } } catch (Exception) { } }
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; } } }
//private delegate void EnsureChannelCaller (IDictionary <string, object> specs, out bool yours, out ObjectPath path, out IDictionary <string, object> properties); public override void Request() { IDictionary <string, object> channel_specs = new Dictionary <string, object> (); channel_specs.Add(Constants.CHANNEL_IFACE + ".ChannelType", ChannelType); channel_specs.Add(Constants.CHANNEL_IFACE + ".TargetHandleType", HandleType.List); channel_specs.Add(Constants.CHANNEL_IFACE + ".TargetID", this.target_id); bool yours = false; ObjectPath object_path = null; Requests.EnsureChannel(channel_specs, out yours, out object_path, out channel_properties); this.ChannPath = object_path.ToString(); group = DBusUtility.GetProxy <IGroup> (Connection.Bus, Connection.BusName, ChannPath); group.MembersChanged += OnMembersChanged; OnChannelReady(EventArgs.Empty); }
internal protected Avatar(Contact contact) : this() { this.contact = contact; avatars = DBusUtility.GetProxy <IAvatars> (Connection.Bus, Connection.BusName, Connection.ObjectPath); }
protected override void SetProxyObject() { ft = DBusUtility.GetProxy <IFileTransfer> (Connection.BusName, ObjectPath); }
protected override void SetProxyObject() { tube = DBusUtility.GetProxy <IDBusTube> (Connection.BusName, ObjectPath); }