robbiehanson / XMPPFramework

An XMPP Framework in Objective-C for Mac and iOS
Other
5.91k stars 2.09k forks source link

Register User, Get History, Forgot Password #418

Open jagdish24 opened 10 years ago

jagdish24 commented 10 years ago

Hello I have did Chat with openfire server and XMPP framework in iOS. Now i stuck at Register user, get history, forgot password etc.

Please do needful to get me with XEPs in objective c.

@ObjColumnist PLease help to find out way for to register new user in XMPP iphone, How to get history and give password reset facility to user.

Regards, Jagds

ObjColumnist commented 10 years ago

Registration is handled by XMPPStream (it has to be supported by the server), take a look at these 3 methods and this issue #330

- (BOOL)supportsInBandRegistration;
- (BOOL)registerWithElements:(NSArray *)elements error:(NSError **)errPtr;
- (BOOL)registerWithPassword:(NSString *)password error:(NSError **)errPtr;

History can be fetched using XEP 0136 or XEP 0313, but neither are implemented by the XMPPFramework and not many public XMPP Servers support it.

Im not aware of standard way of implementing forgotten password using XMPP.

jagdish24 commented 10 years ago

@ObjColumnist Thanks for info. But little confusion now.

I have Openfire server installed on Linux.

-(BOOL)supportsInBandRegistration; 

method gives me false value.

So Is there any other way to handle.

I searched and found XEP-0077 is for InBand Registation. Will it work in my case ? How to make XEPs in objective c ?

please guide me in words. I m stuck here.

ObjColumnist commented 10 years ago

This means that openfire doesn't support in band registration or it hasn't been enabled in settings.

jagdish24 commented 10 years ago

screen shot 2014-08-04 at 1 35 33 pm

Just enable and check.. But still not working..

Getting same error,

Error Domain=XMPPStreamErrorDomain Code=4 "The server does not support in band registration." UserInfo=0x112123d30 {NSLocalizedDescription=The server does not support in band registration.}
ObjColumnist commented 10 years ago

I would check that the server offers the register feature (by looking in the console)

register xmlns="http://jabber.org/features/iq-register"

The XMPPStream methods for in band registration are those mentioned in XEP-0077

jagdish24 commented 10 years ago

How to make XEPs in objective c ? Please guide.

ObjColumnist commented 10 years ago

Take a look at the https://github.com/robbiehanson/XMPPFramework/tree/master/Extensions for examples of XEPs.

jagdish24 commented 10 years ago

Yes i see these. :+1:

Let me try to add XEP-0077 for In Band Registration. If i stuck somewhere will knock your door again.

Thanks for your valuable time.

ObjColumnist commented 10 years ago

I believe the In Band Registration APIs on XMPPStream are XEP-0077

The issue is that the client doesn't think the server supports it, as the server should advertise it as a stream feature:

<stream:features>
  <register xmlns='http://jabber.org/features/iq-register'/>
</stream:features>
jagdish24 commented 10 years ago

So, Is it not possible ??

ObjColumnist commented 10 years ago

You need to see what features the server is advertising, to work out if it is a bug with the server or the client.

jagdish24 commented 10 years ago

Not sure if it is correct way to check features of XMPP or not.

I have just get root element

<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="local.cirightlocal" id="c4cfca1a" stream1:lang="en" version="1.0">
<stream:features xmlns:stream="http://etherx.jabber.org/streams">
<compression xmlns="http://jabber.org/features/compress">
<method>zlib</method>
</compression>
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/>
<session xmlns="urn:ietf:params:xml:ns:xmpp-session"/>
</stream:features>
</stream:stream>

Not seeing anywhere iq-register ..

ObjColumnist commented 10 years ago

That is the correct place to look, but sometimes the features get resent e.g. after you have authenticated to offer additional features.

So its an issue with the server not advertising support for in band registration. Other than restarting the server etc I am not sure what to suggest, I am not an expert when it comes to the different XMPP Servers.

jagdish24 commented 10 years ago

I m using OpenFire server and see that In band Registration allowed..

sawantuday commented 9 years ago

It does not work with Tigase as well. Please check the listed Stanza exchange

Sent:

<?xml version="1.0"?>
 <stream:stream xmlns:stream="http://etherx.jabber.org/streams" version="1.0" xmlns="jabber:client" to="xmpp.sweetcouch.com" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace">

Received:

<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='xmpp.sweetcouch.com' id='b83d6a47-86b8-4448-9bb4-fdc12596e1d1' version='1.0' xml:lang='en'>

<stream:features>
<ver xmlns="urn:xmpp:features:rosterver"/>
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<mechanism>PLAIN</mechanism>
<mechanism>ANONYMOUS</mechanism>
</mechanisms>
<register xmlns="http://jabber.org/features/iq-register"/>
<compression xmlns="http://jabber.org/features/compress">
<method>zlib</method>
</compression>
<auth xmlns="http://jabber.org/features/iq-auth"/>
</stream:features>
jmakwana007 commented 8 years ago

Hello friends,I want your help for reset password in xmppframework,i stuck badly in this since 20-25 days,And cant find any solution.i can share my code if needed.please help me.

Narendrapandey commented 7 years ago

@ObjColumnist Hi, How to get chat history from openFire.

let iQ = DDXMLElement.element(withName: "iq") (iQ as AnyObject).addAttribute(withName: "type", stringValue: "get") (iQ as AnyObject).addAttribute(withName: "id", stringValue: "205") let list = DDXMLElement.element(withName: "retrieve") (list as AnyObject).addAttribute(withName: "xmlns", stringValue: "urn:xmpp:archive") (list as AnyObject).addAttribute(withName: "with", stringValue: "pandey@ip-172-31-53-77.ec2.internal") let set = DDXMLElement.element(withName: "set") (set as AnyObject).addAttribute(withName: "xmlns", stringValue: "http://jabber.org/protocol/rsm") let max = DDXMLElement.element(withName: "max") (max as AnyObject).addAttribute(withName: "xmlns", stringValue: "http://jabber.org/protocol/rsm") (set as! DDXMLElement).addChild(max as! DDXMLNode) (list as AnyObject).addChild(set as! DDXMLNode) (iQ as AnyObject).addChild(list as! DDXMLNode) stream?.send(iQ as! DDXMLElement)

But it give me error of 501 type cancel feature not available.

Please help.