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


C# Presence.SwitchDirection方法代碼示例

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


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

示例1: ProcessRosterIQ


//.........這裏部分代碼省略.........

                                        ri = new RosterItem();
                                        ri.Name = userFriend.Nick;
                                        ri.Jid = userFriend.JID;
                                        ri.Subscription = userFriend.SubscriptionType;

                                        newRosterIq.Query.AddRosterItem(ri);

                                        bSend = Send(rosterItem.Jid, newRosterIq);
                                        if (!bSend)
                                        {

                                        }

                                        newPresence.Type = PresenceType.unsubscribed;
                                        bSend = Send(rosterItem.Jid, newPresence);
                                        if (!bSend)
                                        {

                                        }

                                        newPresence = new Presence();
                                        newPresence.From = rosterItem.Jid;
                                        newPresence.To = this.m_ClientAccount.JID;
                                        newPresence.Type = PresenceType.unavailable;
                                        newPresence.Language = this.objClientlanguage.Name;

                                        bSend = Send(newPresence.To, newPresence);
                                        if (!bSend)
                                        {

                                        }

                                        newPresence.SwitchDirection();
                                        bSend = Send(newPresence.To, newPresence);
                                        if (!bSend)
                                        {

                                        }

                                        IQ result = new IQ(IqType.result);
                                        result.Id = iq.Id;
                                        result.From = this.m_ClientAccount.JID;
                                        result.To = this.m_ClientAccount.JID;
                                        Send(result);


                                        newRosterIq = new RosterIq(IqType.set);
                                        newRosterIq.Namespace = agsXMPP.Uri.CLIENT;

                                        ri = new RosterItem();
                                        ri.Name = rosterItem.Name;
                                        ri.Jid = rosterItem.Jid;
                                        ri.Subscription = rosterItem.Subscription;

                                        newRosterIq.Query.AddRosterItem(ri);

                                        Send(newRosterIq);


                                    }
                                    else if (userFriend.SubscriptionType == SubscriptionType.from)
                                    {
                                        contactAccount.RemoveFriend(userFriend);
                                        contactAccount.Save();
開發者ID:SiteView,項目名稱:ECC8.13,代碼行數:66,代碼來源:XmppServerConnection.cs

示例2: ProcessPresence


//.........這裏部分代碼省略.........
                                            {
                                                newPresence = new Presence();
                                                newPresence.From = new Jid(presence.To.Bare + "/" + user.Nick);
                                                newPresence.To = login.JID;

                                                newPresence.MucUser = new agsXMPP.protocol.x.muc.User();
                                                newPresence.MucUser.Item = new agsXMPP.protocol.x.muc.Item(user.Affiliation, user.Role);

                                                Send(newPresence.To, newPresence);


                                                newPresence = new Presence();
                                                newPresence.From = new Jid(presence.To.Bare + "/" + login.Nick); ;
                                                newPresence.To = user.JID;

                                                newPresence.MucUser = new agsXMPP.protocol.x.muc.User();
                                                newPresence.MucUser.Item = new agsXMPP.protocol.x.muc.Item(login.Affiliation, login.Role);

                                                Send(newPresence.To, newPresence);

                                            }

                                            item.Value.Enter(login);
                                        }
                                    }

                                    return;

                                }

                            }
                        }

                        foreach (Friend friend in this.m_ClientAccount.Friends)
                        {

                            Account account = this.m_Server.AccountManager.FindAccount(friend.JID.ToString());
                            if (account == null)
                            {
                                continue;
                            }

                            if (!this.m_Server.ClientConnections.ContainsKey(account))
                            {
                                continue;
                            }

                            Presence newPresence = new Presence();
                            //newPresence.From = presence.From;
                            //newPresence.To = presence.To;

                            newPresence.Priority = presence.Priority;

                            SubscriptionType subscriptionType = friend.SubscriptionType;

                            if (subscriptionType == SubscriptionType.from)
                            {
                                newPresence.From = account.JID;
                                newPresence.To = this.m_ClientAccount.JID;
                                Send(newPresence);
                            }
                            else if (subscriptionType == SubscriptionType.to)
                            {
                                newPresence.From = this.m_ClientAccount.JID;
                                newPresence.To = account.JID;

                                Send(account, newPresence);

                            }
                            else if (subscriptionType == SubscriptionType.both)
                            {
                                newPresence.From = account.JID;
                                newPresence.To = this.m_ClientAccount.JID;
                                Send(newPresence);

                                newPresence.SwitchDirection();
                                //this.m_Server.ClientConnections[account].Send(newPresence);
                                Send(account, newPresence);
                            }
                            else
                            {

                            }
                        }

                    }
                    #endregion
                    #region else
                    else
                    {

                    }
                    #endregion

                }
                #endregion

                this.m_Server.AccountManager.Save();

            }
開發者ID:SiteView,項目名稱:ECC8.13,代碼行數:101,代碼來源:XmppServerConnection.cs


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