Esempio n. 1
0
 ///<summary>
 ///	When user clicks to remove a currently authorized person
 ///</summary>
 private void OnRemoveClicked(object o, EventArgs args)
 {
     removeRequested = true;
     Logger.Debug("OnRemoveClicked called for {0} with relationship {1}", person.DisplayName, person.ProviderUser.Relationship);
     if (person.ProviderUser.Relationship == ProviderUserRelationship.ReceivedInvitation)
     {
         Logger.Debug("Relationship is RecievedInvitation, calling DenyAuthorization()");
         person.ProviderUser.DenyAuthorization(String.Empty);
     }
     else if (person.ProviderUser.Relationship == ProviderUserRelationship.SentInvitation)
     {
         Logger.Debug("Relationship is SentInvitation, calling RevokeInvitation()");
         person.ProviderUser.RevokeInvitation();
     }
     else
     {
         Logger.Debug("Relationship is only other case, calling RemoveUser()");
         person.ProviderUser.RemoveUser();
     }
     removeButton.Sensitive = !removeRequested;
     statusLabel.Markup     = String.Format("<span foreground=\"#373935\" style=\"italic\" size=\"small\">{0}</span>",
                                            Catalog.GetString("Removing..."));
     if (textButton != null)
     {
         actionBox.Remove(textButton);
         textButton = null;
     }
     if (audioButton != null)
     {
         actionBox.Remove(audioButton);
         audioButton = null;
     }
     if (videoButton != null)
     {
         actionBox.Remove(videoButton);
         videoButton = null;
     }
     if (authorizeButton != null)
     {
         actionBox.Remove(authorizeButton);
         authorizeButton = null;
     }
 }
Esempio n. 2
0
        ///<summary>
        ///	Handles Presence Events on a Person
        ///</summary>
        private void OnPersonPresenceUpdated(Person person)
        {
            //Logger.Debug("OnPersonPresenceUpdated on {0}", person.DisplayName);
            UpdateName();
            UpdateStatus();

            if (person.ProviderUser.Relationship == ProviderUserRelationship.ReceivedInvitation)
            {
                if (authorizeButton == null)
                {
                    Gtk.Image actionImage = new Gtk.Image(Utilities.GetIcon("add", 24));
                    authorizeButton             = new Gtk.Button();
                    authorizeButton.BorderWidth = 0;
                    authorizeButton.Relief      = Gtk.ReliefStyle.None;
                    authorizeButton.CanFocus    = false;
                    authorizeButton.Clicked    += OnAuthorizeClicked;
                    authorizeButton.Image       = actionImage;
                    actionBox.PackEnd(authorizeButton, false, false, 0);
                    authorizeButton.Show();
                    toolTips.SetTip(authorizeButton,
                                    Catalog.GetString("Authorize this person"),
                                    Catalog.GetString("Authorize this person to chat with you"));
                }
            }
            else if (person.ProviderUser.Relationship == ProviderUserRelationship.SentInvitation)
            {
                // do nothing, there is already a remove button available
            }
            else
            {
                // Add capabilities icons if they have any capabilities
                // change this later to show their capabilities when we actually have them
                if (person.Presence.Type != PresenceType.Offline)
                {
                    if (videoButton == null &&
                        (person.ProviderUser.MediaCapability & Banter.MediaCapability.Video) ==
                        Banter.MediaCapability.Video)
                    {
                        Gtk.Image actionImage = new Gtk.Image(Utilities.GetIcon("webcam", 24));

                        videoButton             = new NotifyButton();
                        videoButton.BorderWidth = 0;
                        videoButton.Relief      = Gtk.ReliefStyle.None;
                        videoButton.CanFocus    = false;
                        videoButton.Image       = actionImage;
                        videoButton.Clicked    += OnVideoChatClicked;
                        actionBox.PackEnd(videoButton, false, false, 0);
                        videoButton.Show();
                        toolTips.SetTip(videoButton,
                                        Catalog.GetString("Start a video chat"),
                                        Catalog.GetString("Start a video chat"));
                    }

                    if (audioButton == null &&
                        (person.ProviderUser.MediaCapability & Banter.MediaCapability.Audio) ==
                        Banter.MediaCapability.Audio)
                    {
                        Gtk.Image actionImage = new Gtk.Image(Utilities.GetIcon("mic", 24));
                        audioButton             = new NotifyButton();
                        audioButton.BorderWidth = 0;
                        audioButton.Relief      = Gtk.ReliefStyle.None;
                        audioButton.CanFocus    = false;
                        audioButton.Image       = actionImage;
                        audioButton.Clicked    += OnAudioChatClicked;
                        actionBox.PackEnd(audioButton, false, false, 0);
                        audioButton.Show();
                        toolTips.SetTip(audioButton,
                                        Catalog.GetString("Start an audio chat"),
                                        Catalog.GetString("Start an audio chat"));
                    }

                    if (textButton == null)
                    {
                        Gtk.Image actionImage = new Gtk.Image(Utilities.GetIcon("text", 24));
                        textButton             = new NotifyButton();
                        textButton.BorderWidth = 0;
                        textButton.Relief      = Gtk.ReliefStyle.None;
                        textButton.CanFocus    = false;
                        textButton.Clicked    += OnTextChatClicked;
                        textButton.Image       = actionImage;
                        actionBox.PackEnd(textButton, false, false, 0);
                        textButton.Show();
                        toolTips.SetTip(textButton,
                                        Catalog.GetString("Start a text chat"),
                                        Catalog.GetString("Start a text chat"));
                    }

                    // Make sure to remove these, the user may have just been added
                    if (authorizeButton != null)
                    {
                        actionBox.Remove(authorizeButton);
                        authorizeButton = null;
                    }
                }
                else
                {
                    if (textButton != null)
                    {
                        actionBox.Remove(textButton);
                        textButton = null;
                    }
                    if (audioButton != null)
                    {
                        actionBox.Remove(audioButton);
                        audioButton = null;
                    }
                    if (videoButton != null)
                    {
                        actionBox.Remove(videoButton);
                        videoButton = null;
                    }
                    if (authorizeButton != null)
                    {
                        actionBox.Remove(authorizeButton);
                        authorizeButton = null;
                    }
                }
            }
        }