Beispiel #1
0
        public void SetResource(
            string id,
            int priority = 0,
            Tags.jabber.client.show.valueEnum status = Tags.jabber.client.show.valueEnum.none,
            string statusMessage = ""
            )
        {
            if (!string.IsNullOrEmpty(id))
            {
                var resource = default(Resource);
                if (Resources.ContainsKey(id))
                {
                    resource = Resources[id];
                }
                else
                {
                    Resources[id] = new Resource();
                    resource      = Resources[id];
                }

                resource.id            = id;
                resource.priority      = priority;
                resource.status        = status;
                resource.statusMessage = statusMessage;

                EmitPropertyChanged("IsOnline");
                EmitPropertyChanged("Resources");
                EmitPropertyChanged("CurrentResource");
                EmitPropertyChanged("HasStatusMessage");
                EmitPropertyChanged("CurrentStatus");
                EmitPropertyChanged("CurrentStatusMessage");
                ContactUpdated(this);
            }
        }
Beispiel #2
0
        public static void PublishState(Tags.jabber.client.show.valueEnum statusValue, string message)
        {
            var accounts = new Accounts();

            foreach (var account in accounts.Enabled)
            {
                PublishState(account.jid, statusValue, message);
            }
        }
Beispiel #3
0
 public static void PublishState(string account, StatusType status, string message)
 {
     Tags.jabber.client.show.valueEnum statusValue = Tags.jabber.client.show.valueEnum.none;
     if (status == StatusType.Available)
     {
         statusValue = Tags.jabber.client.show.valueEnum.none;
     }
     if (status == StatusType.Away)
     {
         statusValue = Tags.jabber.client.show.valueEnum.away;
     }
     if (status == StatusType.Busy)
     {
         statusValue = Tags.jabber.client.show.valueEnum.dnd;
     }
     PublishState(account, statusValue, message);
 }
Beispiel #4
0
        public static void PublishState(string account, Tags.jabber.client.show.valueEnum statusValue, string message)
        {
#if DEBUG
            System.Diagnostics.Debug.WriteLine("[Frontend] Publishing State for: " + account);
#endif

            var presence = new Tags.jabber.client.presence();

            if (!string.IsNullOrEmpty(message))
            {
                var status = new Tags.jabber.client.status();
                status.Value = message;
                presence.Add(status);
            }

            if (statusValue != Tags.jabber.client.show.valueEnum.none)
            {
                var show = new Tags.jabber.client.show();
                show.Value = statusValue;
                presence.Add(show);
            }

            Runtime.Interface.SendTag(account, presence);
        }