Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiUserChat.SetPrivilege called Get, but never Set - Bug #53

Open
cimframe opened this issue Feb 11, 2017 · 0 comments
Open

MultiUserChat.SetPrivilege called Get, but never Set - Bug #53

cimframe opened this issue Feb 11, 2017 · 0 comments

Comments

@cimframe
Copy link

The SetPrivilege methods never called set, hence never set any affiliation or role values. Instead, these overridden methods called a superfluous method PostSetPrivilege which did a get, but the purpose of the methods is in question. I propose rewriting the methods to do a set (hence, their name) and an example of one of the methods would look as follows:

		/// <summary>
		/// Allows owners and admins to change affiliations for an occupant.
		/// </summary>
		public bool SetPrivilege (Jid room, string nickname, Affiliation affiliation, string reason = null) {

			room.ThrowIfNull ("room");
			nickname.ThrowIfNull ("nickname");

			var item = Xml.Element ("item")
				.Attr ("affiliation", affiliation.ToString ().ToLower ())
				.Attr ("nick", nickname);

			if (!string.IsNullOrWhiteSpace (reason)) {
				item.Child (Xml.Element ("reason").Text (reason));
			}

			var queryElement = Xml.Element ("query", MucNs.NsAdmin)
				.Child (item);

			var iq = im.IqRequest (IqType.Set, room, im.Jid, queryElement);

			return iq.Type == IqType.Result;
		}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant