Exemplo n.º 1
0
        public StatusEntry()
        {
            ModifyBg (StateType.Normal, Style.Background (StateType.Active));
            BorderWidth = 0;

            customAvailableMessages = new SerializableDictionary<string,string> ();
            customBusyMessages = new SerializableDictionary<string,string> ();
            customAwayMessages = new SerializableDictionary<string,string> ();

            presence = null;
            potentialPresenceType = PresenceType.Offline;

            notebook = new Notebook ();
            notebook.ModifyBg (StateType.Normal, Style.Background (StateType.Active));
            notebook.ShowTabs = false;
            notebook.ShowBorder = false;

            notebook.AppendPage (CreateViewWidget (), new Label ());
            notebook.AppendPage (CreateEditWidget (), new Label());

            notebook.Show ();

            Add (notebook);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Signal called when presence changes for the peer user.
        /// </summary>
        private void OnPeerPresenceUpdated(ProviderUser user)
        {
            string msg;
            Banter.SystemMessage systemMessage = null;

            // no handlers?  exit
            if (MessageReceived == null) return;

            string displayName = (user.Alias != null) ? user.Alias.Split (' ')[0] : user.Uri;
            if (user.Presence.Type == Banter.PresenceType.Offline) {
                msg = String.Format("{0} has gone {1}", displayName, user.Presence.Name);
                systemMessage = new Banter.SystemMessage (msg);
            } else {
                if (user.Presence.Message != null &&
                    user.Presence.Message != String.Empty &&
                    user.Presence.Message != lastPeerPresence.Message) {

                    msg = String.Format(
                            "{0} is {1} \"{2}\"",
                            displayName,
                            user.Presence.Name,
                            user.Presence.Message);
                    systemMessage = new Banter.SystemMessage (msg);

                } else {
                    msg = String.Format("{0} is {1}", displayName, user.Presence.Name);
                    systemMessage = new Banter.SystemMessage (msg);
                }
            }

            lastPeerPresence = user.Presence;

            // Indicate the message to registered handlers
            if (systemMessage != null)
                MessageReceived (this, systemMessage);
        }
Exemplo n.º 3
0
 private void Init(Account account, ProviderUser providerUser)
 {
     this.account = account;
     this.tlpConnection = this.account.TlpConnection;
     this.peerUser = providerUser;
     this.callType = CallType.None;
     this.messages = new List<Message> ();
     this.last = 999;
     this.videoStreams = new Dictionary<uint,uint> ();
     this.audioStreams = new Dictionary<uint,uint> ();
     this.peerUser.PresenceUpdated += OnPeerPresenceUpdated;
     this.lastPeerPresence = this.peerUser.Presence;
     this.inRemoveMedia = false;  //hack
 }
Exemplo n.º 4
0
        private void OnStatusEntryChanged(Presence presence)
        {
            //Logger.Debug ("Setting presence on Me to {0}", presence.Message);
            if (PersonManager.Me != null) {
                PersonManager.Me.SetStatus (presence);

                Logger.Debug ("FIXME: Save off a custom presence message so when Banter restarts, they'll be available.");
            }
        }
Exemplo n.º 5
0
 public StatusMenuItem(Presence presence)
     : base(presence.Message)
 {
     this.presence = presence;
 }
Exemplo n.º 6
0
        private void OnStatusEntryActivated(object sender, EventArgs args)
        {
            string potentialMessage = statusEntry.Text.Trim ();

            if (potentialMessage.Length > 0) {
                if (potentialPresenceType != PresenceType.Offline)
                    Presence = new Presence (potentialPresenceType, potentialMessage);
                else
                    Presence = new Presence (presence.Type, potentialMessage);
            }
            this.SaveStatus ();
            SwitchToViewMode ();
        }
Exemplo n.º 7
0
 private void OnBusyMessageSelected(object sender, EventArgs args)
 {
     StatusMenuItem item = sender as StatusMenuItem;
     Presence = new Presence(PresenceType.Busy, item.Message);
 }