當前位置: 首頁>>代碼示例>>C#>>正文


C# client.Presence類代碼示例

本文整理匯總了C#中agsXMPP.protocol.client.Presence的典型用法代碼示例。如果您正苦於以下問題:C# Presence類的具體用法?C# Presence怎麽用?C# Presence使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Presence類屬於agsXMPP.protocol.client命名空間,在下文中一共展示了Presence類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Client

 public Client()
 {
     Xmpp = new XmppClientConnection("skylabsonline.com");
     Xmpp.OnRegistered += XmppOnOnRegistered;
     Xmpp.OnRegisterError += XmppOnOnRegisterError;
     Xmpp.OnXmppConnectionStateChanged += XmppOnOnXmppConnectionStateChanged;
     Xmpp.OnLogin += XmppOnOnLogin;
     Xmpp.OnAuthError += XmppOnOnAuthError;
     Xmpp.OnRosterItem += XmppOnOnRosterItem;
     Xmpp.OnRosterEnd += XmppOnOnRosterEnd;
     Xmpp.OnRosterStart += XmppOnOnRosterStart;
     Xmpp.OnMessage += XmppOnOnMessage;
     Xmpp.OnPresence += XmppOnOnPresence;
     Xmpp.OnAgentItem += XmppOnOnAgentItem;
     Xmpp.OnIq += XmppOnOnIq;
     Xmpp.OnReadXml += XmppOnOnReadXml;
     Notifications = new List<Notification>();
     Friends = new List<NewUser>();
     //GroupChats = new List<NewUser>();
     myPresence = new Presence();
     Chatting = new Chat(this,Xmpp);
     CurrentHostedGamePort = -1;
     _games = new List<HostedGameData>();
     agsXMPP.Factory.ElementFactory.AddElementType("gameitem", "octgn:gameitem", typeof(HostedGameData));
 }
開發者ID:bejumi,項目名稱:OCTGN,代碼行數:25,代碼來源:Client.cs

示例2: GetRosterImageIndex

 public static int GetRosterImageIndex(Presence pres)
 {
     if (pres.Type == PresenceType.unavailable)
     {
         return 0;
     }
     else if (pres.Type == PresenceType.error)
     {
         // Don't do anythng here?
     }
     else
     {
         switch (pres.Show)
         {
             case ShowType.NONE:
                 return 1;
             case ShowType.away:
                 return 2;
             case ShowType.chat:
                 return 4;
             case ShowType.xa:
                 return 3;
             case ShowType.dnd:
                 return 5;
         }
     }
     return 0;
 }
開發者ID:koralarts,項目名稱:HipsterChat,代碼行數:28,代碼來源:Util.cs

示例3: Contact

        public Contact(Presence presence)
        {
            _rosterItem = new RosterItem();
            _rosterItem.Jid = presence.From;

            BuildSearchText();
        }
開發者ID:erpframework,項目名稱:xeus-messenger2,代碼行數:7,代碼來源:Contact.cs

示例4: GetPointsOfShowType

        private static int GetPointsOfShowType(Presence presence)
        {
            if (presence == null)
            {
                return 0;
            }

            if (presence.Type == PresenceType.available)
            {
                switch (presence.Show)
                {
                    case ShowType.dnd:
                        {
                            return 3;
                        }
                    case ShowType.xa:
                        {
                            return 4;
                        }
                    case ShowType.away:
                        {
                            return 5;
                        }
                    default:
                        {
                            return 6;
                        }
                }
            }
            else
            {
                return 0;
            }
        }
開發者ID:erpframework,項目名稱:xeus-messenger2,代碼行數:34,代碼來源:PresenceCompare.cs

示例5: update

        //TODO: also check showType
        public void update(Presence presence)
        {
            string sJid = presence.From.Bare;
            string sText = presence.Status;
            bool isOnline = false;

            //handle PresenceType
            if ((presence.Type == PresenceType.available) || (presence.Type == PresenceType.invisible)) {
                isOnline = true;
            } else if (presence.Type == PresenceType.subscribe) {
                //TODO: handle subscribe request
            } else if (presence.Type == PresenceType.subscribed) {
                //TODO: handle answered subscribe message
            } else if (presence.Type == PresenceType.unavailable) {
                isOnline = false;
            }

            //update presenceList
            for (int i = 0; i < m_PresenceList.Count; i++) {
                if (m_PresenceList [i].sJid == sJid) {
                    m_PresenceList.RemoveAt (i);
                    break;
                }
            }

            //add ContactPresence if it does not exist
            ContactPresence newPresence = new ContactPresence ();
            newPresence.sJid = sJid;
            newPresence.bIsOnline = isOnline;
            newPresence.sText = sText;

            this.m_PresenceList.Add (newPresence);
        }
開發者ID:crypto-ink,項目名稱:CryptoInkLib,代碼行數:34,代碼來源:PresenceManager.cs

示例6: XmppConnectOnOnPresence

 public void XmppConnectOnOnPresence(object sender, Presence pres)
 {
     try
     {
         if (pres.GetAttribute("name") == "Facebook User")
         {
             return;
         }
         Core.Presences.Add(pres);
         try
         {
             var chatItem = new ChatPlayerItem
             {
                 Group = pres.GetAttribute("group"),
                 IsOnline = true,
                 Jid = new Jid(pres.GetAttribute("jid")),
                 Messages = new List<string>(),
                 Username = pres.GetAttribute("name")
             };
             Core.AllPlayers.Add(pres.GetAttribute("name"), chatItem);
         }
         catch
         {
             var item = Core.AllPlayers[pres.GetAttribute("name")];
             Core.AllPlayers.Remove(pres.GetAttribute("name"));
             item.IsOnline = true;
             Core.AllPlayers.Add(pres.GetAttribute("name"), item);
         }
     }
     catch
     {
         //MessageBox.Show(ex.ToString());
     }
 }
開發者ID:huynkprovn,項目名稱:Facebook-Desktop,代碼行數:34,代碼來源:LoginPage.xaml.cs

示例7: Unsubcribe

        /// <summary>
        /// Unsubscribe from a contact
        /// </summary>
        /// <param name="to">Bare Jid of the rosteritem we want to unsubscribe</param>
		public void Unsubcribe(Jid to)
		{
			// <presence to='[email protected]' type='subscribe'/>
			Presence pres = new Presence();
			pres.Type = PresenceType.unsubscribe;
			pres.To = to;

			m_connection.Send(pres);
		}
開發者ID:SiteView,項目名稱:ECC8.13,代碼行數:13,代碼來源:PresenceManager.cs

示例8: EventPresenceChanged

        public EventPresenceChanged(Contact contact, Presence oldPresence, Presence newPresence)
            : base(String.Empty, EventSeverity.Info)
        {
            _contact = contact;
            _oldPresence = oldPresence;
            _newPresence = newPresence;

            Expiration = DateTime.Now.AddSeconds(Settings.Default.UI_Notify_Presence_Exp);
        }
開發者ID:erpframework,項目名稱:xeus-messenger2,代碼行數:9,代碼來源:EventStatusChanged.cs

示例9: RefuseSubscriptionRequest

        //Example: Refusing a presence subscription request:
        //<presence to='[email protected]' type='unsubscribed'/>
        /// <summary>
        /// Refuse  subscription request
        /// </summary>
        /// <param name="to">Bare Jid to approve</param>
        public void RefuseSubscriptionRequest(Jid to)
        {
            // <presence to='[email protected]' type='subscribe'/>
            Presence pres = new Presence();
            pres.Type = PresenceType.unsubscribed;
            pres.To = to;

            m_connection.Send(pres);
        }
開發者ID:jptoto,項目名稱:argsxmpp,代碼行數:15,代碼來源:PresenceManager.cs

示例10: Subcribe

        /// <summary>        
        /// Subscribe to a contact
        /// </summary>        
        /// <param name="to">Bare Jid of the rosteritem we want to subscribe</param>
        /// <param name="message">a message which normally contains the reason why we want to subscibe to this contact</param>
        public void Subcribe(Jid to, string message)
        {
            Presence pres = new Presence();
            pres.Type = PresenceType.subscribe;
            pres.To = to;
            pres.Status = message;

            m_connection.Send(pres);
        }
開發者ID:SiteView,項目名稱:ECC8.13,代碼行數:14,代碼來源:PresenceManager.cs

示例11: AskAuthorization

        public AskAuthorization(Presence presence)
            : base(_keyBase, presence.From.Bare)
        {
            InitializeComponent();

            Contact contact = new Contact(presence);

            DataContext = contact;
            _contact.Content = contact;
        }
開發者ID:erpframework,項目名稱:xeus-messenger2,代碼行數:10,代碼來源:AskAuthorization.xaml.cs

示例12: OnPresence

 private void OnPresence(object sender, Presence pres)
 {
     foreach (var presenceHandler in _handlers)
     {
         if (presenceHandler.IsApplicable(pres))
         {
             presenceHandler.UpdateState(pres);
         }
     }
 }
開發者ID:Irdis,項目名稱:VSTalk,代碼行數:10,代碼來源:PresenceObserver.cs

示例13: frmGroupChat_FormClosed

 /// <summary>
 /// Envio una precencia de aviso de abandono de sala
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmGroupChat_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (_RoomJid != null)
     {
         Presence pres = new Presence();
         pres.To = _RoomJid;
         pres.Type = PresenceType.unavailable;
         Util.XmppServices.XmppCon.Send(pres);
     }
 }
開發者ID:spzenk,項目名稱:sfdocsamples,代碼行數:15,代碼來源:frmGroupChat.cs

示例14: xmpp_OnPresence

 private void xmpp_OnPresence(object sender, Presence pres)
 {
     if (pres.Type == PresenceType.subscribe)
     {
         xmpp.PresenceManager.ApproveSubscriptionRequest(pres.From);
     }
     else if (pres.Type == PresenceType.available)
     {
         //Xmpp.Send(new Message(pres.From, "Versículo de hoje: \"Porque Deus amou ao mundo de tal maneira que deu o seu Filho unigênito, para que todo o que nele crê não pereça, mas tenha a vida eterna.\" João 3:16"));
     }
 }
開發者ID:abibliafalada,項目名稱:abibliafalada-v2,代碼行數:11,代碼來源:GTalkBot.cs

示例15: OnPresence

 public void OnPresence(Client client, Presence presence)
 {
     var clientContext = SessionModel.GetClientContext(client);
     if (clientContext.Jid.Equals(presence.From, new CaseInsensitiveComparer()))
     {
         return;
     }
     var fromJid = presence.From.ToString().ToLower();
     var capsKey = new CapsSource(client, fromJid);
     ProcessedPresence(capsKey, presence);
 }
開發者ID:Irdis,項目名稱:VSTalk,代碼行數:11,代碼來源:CapsService.cs


注:本文中的agsXMPP.protocol.client.Presence類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。