Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
choquito #1
Member since Mar 2013 · 21 posts · Location: Spain
Group memberships: Members
Show profile · Link to this post
Subject: ModifyList method in MucManager
Hi Alex,

I need  to assign a new member for a muc. Can I do it with the ModifyList method of mucmanager..can you reply this message with a sample...?

thank you.
Avatar
Alex #2
Member since Feb 2003 · 4295 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
first you get the Memberlist, then you can add or remove members and submit the new list.
Here is a code example:

  1. private async void  ModifyMemberList()
  2. {
  3.     var list = await mm.RequestMemberListAsync(_roomJid);
  4.     var members = list.Element<AdminQuery>().GetItems().ToList();
  5.  
  6.     // add a new member
  7.     members.Add(new Matrix.Xmpp.Muc.Admin.Item
  8.     {
  9.         Jid = "foo@server.com",
  10.         Nickname = "Foo User",
  11.         Affiliation = Matrix.Xmpp.Muc.Affiliation.member
  12.     });
  13.  
  14.     var ret = await mm.ModifyListAsync(_roomJid, members.ToArray());
  15. }
This post was edited on 2014-05-16, 23:46 by Alex.
Avatar
choquito #3
Member since Mar 2013 · 21 posts · Location: Spain
Group memberships: Members
Show profile · Link to this post
Thank you very much Alex...fast and efficient as always ...
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS