Exemple #1
0
		private void DestroyRoom(Destroy destroy)
		{
			Presence offline = new Presence();
			offline.Type = PresenceType.unavailable;
			User user = new User();
			user.Item = new Item(Affiliation.none, Role.none);
			offline.AddChild(user);
			user.AddChild(destroy);
			destroy.Namespace = null;

			foreach (MucRoomMember member in members)
			{
				offline.From = member.Jid;
				member.Send(offline);
			}
			members.Clear();
			mucService.RemoveRoom(this);
		}
Exemple #2
0
		public void DeclinedUser(Message msg, User user, XmppStream stream)
		{
			Message declineMsg = new Message(user.Decline.To, Jid, MessageType.normal, null);
			User userElement = new User();
			userElement.Decline = new Decline();
			userElement.Decline.From = msg.From;
			userElement.Decline.Reason = user.Decline.Reason;
			declineMsg.RemoveAllChildNodes();
			declineMsg.AddChild(userElement);
			Send(declineMsg);
		}
Exemple #3
0
		public void InviteUser(Message msg, User user, XmppStream stream)
		{
			if (RoomSettings.CanInvite)
			{
				Message inviteMsg = new Message(user.Invite.To, Jid, MessageType.normal, null);
				User userElement = new User();
				userElement.Invite = new Invite();

				MucRoomMember member = GetRealMember(msg.From);
				userElement.Invite.From = member == null ? msg.From : member.Jid;
				userElement.Invite.Reason = user.Invite.Reason;
				inviteMsg.RemoveAllChildNodes();
				inviteMsg.AddChild(userElement);

				if (!Send(inviteMsg))
				{
					// Return error
					msg.SwitchDirection();
					msg.Type = MessageType.error;
					msg.Error = new Error(ErrorType.cancel, ErrorCondition.ItemNotFound);
					Sender.SendTo(stream, msg);
				}
			}
			else
			{
				msg.SwitchDirection();
				msg.Type = MessageType.error;
				msg.Error = new Error(ErrorType.cancel, ErrorCondition.NotAllowed);
				Sender.SendTo(stream, msg);
			}
		}
 private void HandleUserMessage(Message msg, User user, XmppStream stream)
 {
     if (user.Invite != null)
     {
         Room.InviteUser(msg, user, stream);
     }
     else if (user.Decline != null)
     {
         Room.DeclinedUser(msg, user, stream);
     }
 }