PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, July 12, 2022

[FIXED] How do I get the message from the message id in smack.

 July 12, 2022     android, kotlin, message, packet, smack     No comments   

Issue

I am trying to fetch the chat history using below function:

    var mamManager:MamManager= MamManager.getInstanceFor(connection)
    var prevMsg=mamManager.queryArchive(JidCreate.entityBareFrom(jid)).forwardedMessages

        println(msg.forwardedStanza)

But I am getting the output as

04-19 14:17:58.414 7964-7964/com.example.itstym.smackchat I/System.out: Message Stanza [to=user2@replica3377.cloudapp.net,from=user1@replica3377.cloudapp.net/307135084148417199024926,id=qQ73x-27,]

I can also get stanza id using msg.forwardedStanza.stanzaId but how will i get the msg text.


Solution

Cast the forwarded Stanza to Message and call getBody().



Answered By - Flow
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing