当前位置: 首页>>代码示例>>C#>>正文


C# IQ.RemoveAllChildNodes方法代码示例

本文整理汇总了C#中ASC.Xmpp.Core.protocol.client.IQ.RemoveAllChildNodes方法的典型用法代码示例。如果您正苦于以下问题:C# IQ.RemoveAllChildNodes方法的具体用法?C# IQ.RemoveAllChildNodes怎么用?C# IQ.RemoveAllChildNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ASC.Xmpp.Core.protocol.client.IQ的用法示例。


在下文中一共展示了IQ.RemoveAllChildNodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AdminCommand

		public void AdminCommand(IQ iq, MucRoomMember member)
		{
			Admin admin = iq.Query as Admin;
			Admin returnAdmin = new Admin();
			if (admin != null)
			{
				if (iq.Type == IqType.get)
				{
					foreach (Core.protocol.x.muc.iq.admin.Item item in admin.GetItems())
					{
						if (item.Actor == null && item.Affiliation != Affiliation.none)
						{

							foreach (MucRoomMemberInfo mucRoomMember in RoomSettings.Members)
							{
								if (mucRoomMember.Affiliation == item.Affiliation)
								{
									returnAdmin.AddItem(
										new Core.protocol.x.muc.iq.admin.Item(mucRoomMember.Affiliation,
																		 mucRoomMember.Role,
																		 mucRoomMember.Jid));
								}

							}
						}
					}
					iq.Query = returnAdmin;
					iq.Type = IqType.result;
				}
				else if (iq.Type == IqType.set)
				{
					// Change affilation
					foreach (Core.protocol.x.muc.iq.admin.Item item in admin.GetItems())
					{
						if (item.Actor == null)
						{
                            Actor actor = new Actor(){Jid = iq.From};
							MucRoomMemberInfo memberToModify = FindMemberInfo(item);
							if (memberToModify != null)
							{
								//Get member
								if ((int)item.Affiliation != -1)
								{
									if (RoomSettings.CanChangeAffilation(memberToModify.Affiliation,
																		 item.Affiliation,
																		 member.Affiliation))
									{
										memberToModify.Affiliation = item.Affiliation;
										//Try notify online 
										MucRoomMember onlineMember = members.FindByBareJid(memberToModify.Jid);
										if (onlineMember != null)
										{
											onlineMember.Affiliation = item.Affiliation;
										}
									}
									else
									{
										// Error!
										XmppStanzaError.ToErrorStanza(iq, new Error(ErrorCondition.NotAllowed));
										return;
									}
								}

								if ((int)item.Role != -1)
								{
									if (RoomSettings.CanChangeRole(memberToModify.Role,
																   item.Role,
																   member.Role,
																   member.Affiliation))
									{
										memberToModify.Role = item.Role;
										MucRoomMember onlineMember = members.FindByBareJid(memberToModify.Jid);
										if (onlineMember != null)
										{
                                            if (item.Role != Role.none)
                                            {
                                                onlineMember.Role = item.Role;
                                            }
                                            else
                                            {
                                                //Role == none it's a kick
                                                onlineMember.Kick(actor,item.Reason);
                                            }
                                        }
									}
									else
									{
										// Error!
										XmppStanzaError.ToErrorStanza(iq, new Error(ErrorCondition.NotAllowed));
										return;
									}
								}
							}
						}
					}
					SettingsSave();
					iq.RemoveAllChildNodes();
					iq.Type = IqType.result;
				}
			}
//.........这里部分代码省略.........
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:101,代码来源:MucRoom.cs


注:本文中的ASC.Xmpp.Core.protocol.client.IQ.RemoveAllChildNodes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。