Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

asmack send file need fullJID,but I can't get It, how can i get fullJID

$
0
0

1.I had read https://www.igniterealtime.org/builds/smack/docs/latest/documentation/extensions /filetransfer.html

snippet code from this  guide, it not need resource part

 

// Create the file transfer manager
FileTransferManager manager = new FileTransferManager(connection);
// Create the outgoing file transfer
OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer("romeo@montague.net");
// Send the file
transfer.sendFile(new File("shakespeare_complete_works.txt"), "You won't believe this!");

 

2.so I read spark source code org.jivesoftware.spark.PresenceManager find this method , so the documentation long time no to update;

    /**

     * Returns the fully qualified jid of a user.

     *

     * @param jid the users bare jid (ex. derek@jivesoftware.com)

     * @return the fully qualified jid of a user (ex. derek@jivesoftware.com --> derek@jivesoftware.com/spark)

     */

    public static String getFullyQualifiedJID(String jid) {

    System.out.println("getFullyQualifiedJID : " + jid);

        final Roster roster = SparkManager.getConnection().getRoster();

        Presence presence = roster.getPresence(jid);

        System.out.println("getFullyQualifiedJID : " + presence.getFrom());

        return presence.getFrom();

    }

 

3. I find this method not work for asmack , so google it found this

xmpp - Smack's FileTransferManager.createOutgoingFileTransfer only accepts full JIDs. How can I determine the full JID o…

snippet code from my project

 

Roster roster = connection.getRoster();

List<Presence> presenceList = roster.getPresences(jid);

Log.d(TAG, "bareJid : " + jid);

for (Presence presence : presenceList) {

     Log.d(TAG, "fullJID : " + presence.getFrom());

}

 

why the code can not get the fullJID.

the output:

12-23 06:55:35.840: D/MChat(1805): bareJid : test@tigereye-pc

12-23 06:55:35.840: D/MChat(1805): fullJID : test@tigereye-pc

4.the result is the same, so how can I get the fullJID

Thanks & Regards


Viewing all articles
Browse latest Browse all 10742

Trending Articles