Is it possible to change ejabber jId using XMPP Framework iOS - ios

Is there any option to change my jId (ejabberd ID) using XMPP Framework iOS?
suppose currently my jID is 12345#localhost. I want to change it to 6789#localhost.
Its like change phone number feature in WhatsApp.
Can anybody help me please. which class or method to change it. Thank you!

The short answer is no.
A JID is the unique identifier of an entity in an XMPP system. Changing a JID would imply changing all the persistent data (own roster, buddies' rosters, temporarily stored offline messages, past chat history, group chat room membership, ...). I don't know of an XMPP server having this functionality built-in and as far as I can tell there's no XMPP extension defining such a feature.

Related

Using the Swift Contacts Framework

When the app has access to the devices contacts, and you need those contacts to populate a PickerView, does it pull the contacts to a Firebase DB and fetch those contacts to populate the PickerView? Or does it do it within the phone(maybe Core Data)?
Any advice or guidance would be greatly appreciated.
If does and I can use Core Data, can I use it hand in hand with Firebase, or does it even store it somewhere? I'd like my users to be able to select which contacts they want to add to the app.
Thank you in advance.
I think it would be best to pull from the device's Contacts, using the Contacts Framework - in Xcode this is the Contacts.framework package. The Apple site offers some sample code that you might be able to take advantage of in your application. For that you'd need permission from the user by enabling a NSContactsUsageDescription in your info.plist. That describes to the user why you'd need access to their contacts.
As far as storing the data in a Database, I'm not sure that would be a wise decision nor one that makes sense. Consider the reasoning behind that, does this information need to be on some remote database? if your answer is no, then chances are that you don't need to do that extra work. You might however register new users that use your application with something like Google's Firebase if you want to manage any messages between users (for a chat app for example).
Hopefully that answers your question and helps you out in some way.

Swift - How to check if two users are present in JSQMessagesViewController?

We are developing an iOS application which has a chat through JSQMessagesViewController and Firebase. When a message is sent by one user, the other user will receive a notification for the message. However, we desire a functionality where if the other user is in the chat, he should not receive the notification as he can already see all the chat-messages.
What is the best logic / way to implement this desired functionality?
Xcode 8.1, Swift 3, Firebase, JSQMessagesViewController
According to me there are two things that you can do:
1)You can use observers, like typing , for mapping two users when they are in private chat. Just make a status key on firebase and set it to true if two users are on chat page. In this case just don't send push as probably you are sending it from client end.
2)Or you can just ignore notifications when application is active when you see that payload has same user with which you are chatting.
You would probably need to add a presence management system. I did something similar on my app while using Firebase and JSQMessagesViewController, you could probably customize the system to your liking.
Depending on what you use database wise for incoming and outgoing messages with the JSQMessagesViewController library, you could probably set it up there as well.
Firebase has worked best for me for what you're looking to do:
https://firebase.google.com/docs/database/ios/offline-capabilities

How to fetch the phone number for the imessage extension created application

I am trying to implement an iMessage Extension application, i want to fetch the number for whom i have selected the imessage to be created with the app i have created.
How to fetch the number whom I am sending this custom message. Any idea ? as I could not get much information from the Message Class referenced in the 'MSMessage' library file.
I can only access the UUID which is not what I want.
Thanks for any suggestions given.
For the moment it's not possible. It's more a question of privacy, Apple doesn't want dev to access private data like that. Maybe later Apple will allow it via a permission asked to the user (like they do for agenda/position etc).

How to add friends via XMPPFramework

I'm working on an IM application using XMPPFramework. When I want to add a friend, I send a presence stanza, and the friend would be automatically added to XMPPRoster before&whether the other side accepts or rejects. I don't know why. Does any one know? Thanks in advance.
The stanza is like this:
<presence to='juliet#example.com' type='subscribe'/>
After reading the source code and other material. I found that the roster here does not exactly mean what it is in Wechat (a Chinese IM app) or MSN. So those who in your roster does not need to be your friends but the ones who you want to subscribe.

How to get JID for XMPP IOS framework

I just downloaded XMPP framework for IOS and it has an example code when i run the example application it asks for JID and Password
Can anyone let me know how to implement real time chat in IOS.
And how to get JID?
Thanks
A JID is an identifier to connect to an XMPP server. You can deploy your own server (like ejabberd for example), or you can create just an account on a public server (you can find one in this directory for example).

Resources