private void AddSupportedChannels (Connection conn) { IList<APIData.ChannelInfo> channels = new List<APIData.ChannelInfo> (); channels.Add (new DBusTubeChannelInfo (ChannelType.DBusTube, HandleType.Contact, MetadataProviderService.BusName)); channels.Add (new StreamTubeChannelInfo (ChannelType.StreamTube, HandleType.Contact, StreamingServer.ServiceName, StreamingServer.Address)); channels.Add (new FileTransferChannelInfo (ChannelType.FileTransfer, HandleType.Contact, "audio/mpeg", "Telepathy extension for Banshee transfer")); //TODO move this elsewhere? StreamActivity.AutoAccept = true; conn.AdvertiseSupportedChannels ("Banshee", channels); }
protected internal Roster(Connection conn) : this() { this.Connection = conn; iconn_proxy = conn.DBusProxy; }
private void AddConnection (Connection conn) { conn_map.Add (conn.AccountObjectPath, conn); conn.CacheDirectory = Paths.Combine (TelepathyService.CacheDirectory, conn.AccountId); try { //Log.DebugFormat ("Connection object for {0} created successfully", conn.AccountId); source_map.Add (conn.AccountObjectPath, new Dictionary <Contact, ContactSource> ()); conn.Disconnected += OnDisconnected; conn.Roster.RosterStateChanged += OnRosterStateChanged; conn.Roster.Load (); } catch (DBusProxyObjectNotFound e) { Log.Error (e.ToString ()); } }
private void AppendToList (Connection conn) { if (conn == null || conn.Roster == null) { return; } foreach (Contact contact in conn.Roster.GetAllContacts ()) { if (contact == null || contact.Avatar == null) { continue; } MenuTile tile = new MenuTile (); tile.SizeAllocated += delegate (object o, SizeAllocatedArgs args) { int main_width, main_height = 0; main_box.GetSizeRequest (out main_width, out main_height); tile.WidthRequest = main_width; }; tile.PrimaryText = contact.Name; tile.SecondaryText = String.IsNullOrEmpty (contact.StatusMessage) ? contact.Status.ToString () : contact.StatusMessage; Avatar avatar = contact.Avatar; if (avatar.State == AvatarState.Loaded) { tile.Pixbuf = new Gdk.Pixbuf (avatar.Image); avatar.Clear (false); } else { tile_map.Add (contact, tile); avatar.Loaded += delegate(object sender, AvatarStateEventArgs e) { Avatar a = sender as Avatar; if (a != null && tile_map.ContainsKey (a.Contact)) { if (e.State == AvatarState.Loaded) { tile_map[a.Contact].Pixbuf = new Gdk.Pixbuf (a.Image); a.Clear (false); main_box.QueueDraw (); } tile_map.Remove (a.Contact); } }; avatar.Load (); } contacts_view.AddWidget (tile); } }