当前位置: 首页>>代码示例>>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;未经允许,请勿转载。