I have problems to implement the file transfer to my little chat application I’m writting on base of the SMACK API.
I decided to not bother about the exact jid of my friends (firstname.lastname@example.org/RESSOURCE) and only take care of the Bare Adress (email@example.com) to identfy an user internal and display the chat messages in my program.
Now i wanted to implement a very simple FileTranfser-Feature and I came into the following problem:
I’m trying to send a file to a friend in the roster really straight forward like shown in the documentation:
OutgoingFileTransfer transfer = mFileTransferManager.createOutgoingFileTransfer(jidToSend); transfer.sendFile(file, jid);
File is an instance of java.io.File and JID is a String with value e.x "firstname.lastname@example.org".
If i try to start a transfer with the user given without the ressource I imediatelly receive an error packet
<iq id="7VR8D-9" to="email@example.com" from="firstname.lastname@example.org" type="error"> <error code="503" type="CANCEL"> <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/> </error> </iq>
I found that adding a ressource to the jid solves my problems. I tried this with some hardcoded values and jid-strings.
But i did not found a way to determine the ressource(s) of a given user via the smack api or by the roster. How can I find them out?
One of my ideas was to create chats for all entries in the connections roster after successfull connect and login. But in the Chat-Objects the returned participants are also the bare jid adress.
What can I do?
Thanks in advance for your help