Not logged in. · Lost password · Register
Forum: MatriX RSS
Page:  1  2  next
Avatar
wmorrison #1
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Subject: Registering Account on Active Stream
Hello,
      Is it possible to register a new account on an activity stream?  Meaning the account that would be registering the new account would have already been logged on.

Regards,
Will
Avatar
Alex #2
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Most servers have extensions for users which are configured as service administrator on the server.
Eg. on our server as a admin I see in Psi commands like this.

With the Xml below I can add a new user to the server over ad-hoc-commands.


  1. SEND:
  2. <iq type="set" to="ag-software.net" id="ab3ca">
  3. <command xmlns="http://jabber.org/protocol/commands" node="http://jabber.org/protocol/admin#add-user" action="next" sessionid="db38596c-e2c0-4d07-94e9-f409c56e3491">
  4. <x xmlns="jabber:x:data" type="submit">
  5. <field type="hidden" var="FORM_TYPE">
  6. <value>http://jabber.org/protocol/admin</value>
  7. </field>
  8. <field type="jid-single" var="accountjid">
  9. <value>secret</value>
  10. </field>
  11. <field type="text-private" var="password">
  12. <value>secret</value>
  13. </field>
  14. <field type="text-private" var="password-verify">
  15. <value>123xr8orzzq</value>
  16. </field>
  17. </x>
  18. </command>
  19. </iq>
  20.  
  21.  
  22. RECV:
  23. <iq from="ag-software.net" type="result" id="ab3ca" to="alex@ag-software.net/Psi+">
  24. <command xmlns="http://jabber.org/protocol/commands" status="completed" node="http://jabber.org/protocol/admin#add-user" sessionid="db38596c-e2c0-4d07-94e9-f409c56e3491">
  25. <note type="info">Account successfully created</note>
  26. </command>
  27. </iq>
The author has attached one file to this post:
commands.png 8.8 kBytes
You have no permission to open this file.
Avatar
Alex #3
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
here a screenshot of the add user UI
The author has attached one file to this post:
add_user_command.png 6.5 kBytes
You have no permission to open this file.
Avatar
wmorrison #4
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Hi Alex,
       Thanks for the response.  I did not know I could create user outside of the documented approach from your website.  I will look into this ASAP.  This is good information has it will cause me to alter my approach.

Regards,
Will
Avatar
wmorrison #5
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Alex,

Another question:  How do one craft the iq to match Matrix's iq requirements.  This is the iq I am trying to create:

  1. <iq type='set' id='purple97043491' to='adminpc'>
  2.     <command xmlns='http://jabber.org/protocol/commands' node='http://jabber.org/protocol/admin#add-user' action='execute'>
  3.         <query xmlns='jabber:x:data' type='submit'>
  4.             <field var='FORM_TYPE'>
  5.                 <value>http://jabber.org/protocol/admin</value>
  6.             </field>
  7.             <field var='accountjid'>
  8.                 <value>test6test@adminpc</value>
  9.             </field>
  10.             <field var='password'>
  11.                 <value>123456</value>
  12.             </field>
  13.             <field var='password-verify'>
  14.                 <value>123456</value>
  15.             </field>
  16.         </query>
  17.     </command>
  18. </iq>
This post was edited on 2016-03-30, 07:22 by Alex.
Avatar
Alex #6
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Here is and example:

  1. var xdata = new Matrix.Xmpp.XData.Data { Type = FormType.Submit };
  2. xdata.AddField(new Field("FORM_TYPE", "http://jabber.org/protocol/admin"));
  3. xdata.AddField(new Field("accountjid", "test6test@adminpc"));
  4. xdata.AddField(new Field("password", "123456"));
  5. xdata.AddField(new Field("password-verify", "123456"));
  6.  
  7. var cmd = new Matrix.Xmpp.AdHocCommands.Command
  8. {
  9.     Action = Matrix.Xmpp.AdHocCommands.Action.Execute,
  10.     Node = "http://jabber.org/protocol/admin#add-user",
  11.     XData = xdata
  12. };
  13.  
  14. var iq = new IqQuery<Matrix.Xmpp.AdHocCommands.Command>(cmd)
  15. {
  16.     Type = IqType.Set,
  17.     To = "adminpc"
  18. };

the folowing in your Xml is wrong:
  1. <query xmlns='jabber:x:data' type='submit'>...</query>

and should be:
  1. <x xmlns='jabber:x:data' type='submit'>...</x>

see also: XEP-0050: Ad-Hoc Commands
Avatar
wmorrison #7
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
This is great.  I did not know that this was available in Matrix.  Need more Matrix documentation.
Avatar
Alex #8
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
just ask here if you have any questions.
Avatar
wmorrison #9
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
I did the the test and it works fine on windows.  However on the mobile things are setup differently (as usual).  The

  1. var testiq = new IqQuery<Matrix.Xmpp.AdHocCommands.Command>(cmd) {}

comes from either Matrix.Xmpp.Server or Matrix.Xmpp.Component namespaces not from Matrix.Xmpp.Client namespace as on windows.  Therefore I am not sure how to send the output type for testiq ( IqQuery<Command>) to the server.  _xmppAdmin.IqFilter.SendIq or SendIqAsync or SendIqSynchrous will not work with this type and I am not able to cast it to the one I would want.

Regards,
Will
This post was edited 2 times, last on 2016-03-31, 09:35 by Alex.
Avatar
Alex #10
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
which mobile edition of MatriX are you using?
WinRT, Silverlight, Xamarin Android, Xamarin iOS?

Alex
Avatar
wmorrison #11
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
I am investigating Xamarin Android and iOS.
Avatar
Alex #12
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
just add the attached class to you code.
We forgot to add it to the Xamarin builds. It will be included with the next update.

Alex
The author has attached one file to this post:
IqQuery.cs 2.6 kBytes
You have no permission to open this file.
Avatar
wmorrison #13
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Thanks.  It worked however for Action you are sending "Execute" not "execute" to the server which is causing an error.  This is new for version 2.  In version 1 it is "execute".

  1. var cmd = new Matrix.Xmpp.AdHocCommands.Command
  2.                 {
  3.                     Action = Matrix.Xmpp.AdHocCommands.Action.Execute,
  4.                     Node = "http://jabber.org/protocol/admin#add-user",
  5.                     XData = xdata
  6.                 };
This post was edited 4 times, last on 2016-04-01, 10:53 by Alex.
Avatar
Alex #14
Member since Feb 2003 · 4296 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This was fixed a while ago. We will push new nuget packages for the Xamarin versions ASAP.

In the meantime do:
  1. var cmd = new Matrix.Xmpp.AdHocCommands.Command
  2.                 {
  3.                     Node = "http://jabber.org/protocol/admin#add-user",
  4.                     XData = xdata
  5.                 };
  6. cmd.SetAttribute("action", Matrix.Xmpp.AdHocCommands.Action.Execute.ToString().ToLower());
Avatar
wmorrison #15
Member since Dec 2015 · 50 posts · Location: Kingston, Jamaica
Group memberships: Members
Show profile · Link to this post
Messed around and found this out.  All is well
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:
Page:  1  2  next
Forum: MatriX RSS