xmpp - Smack android incoming onStanza is different from debugger -


the gajim client on windows , smack debbuger return kind of stanza, same 1 in xmpp specs.

<message id='aeb213' to='juliet@capulet.lit/chamber'>   <result xmlns='urn:xmpp:mam:2' queryid='f27' id='28482-98726-73623'>     <forwarded xmlns='urn:xmpp:forward:0'>       <delay xmlns='urn:xmpp:delay' stamp='2010-07-10t23:08:25z'/>       <message xmlns='jabber:client' from="witch@shakespeare.lit" to="macbeth@shakespeare.lit">         <body>hail thee</body>       </message>     </forwarded>   </result> </message> 

yet on smack in onstanza returns one:

<message to="juliet@capulet.lit/chamber" from="juliet@capulet.lit/chamber">   <result xmlns="urn:xmpp:mam:0">     <body>hail thee</body>     <stanza-id/>     <delay/>     <archived/>     <data/>   </result> </message> 

how fix this? here's parts of code.

public class xmppservicesmackimpl implements xmppservice, stanzalistener, connectionlistener {     xmppservicelistener xmppservicelistener;     logger logger = logger.getlogger(xmppservicesmackimpl.class.getname());      xmpptcpconnection connection;     string password;      public xmppservicesmackimpl(xmppservicelistener xmppservicelistener) {         this.xmppservicelistener = xmppservicelistener;     }      @override     public void setup(string jid, string password, string authmethod, string hostname, integer port) {         final string[] jidparts = jid.split("@");         string[] servicenameparts = jidparts[1].split("/");         string servicename = servicenameparts[0];          xmpptcpconnectionconfiguration.builder confbuilder = xmpptcpconnectionconfiguration.builder()                 .setservicename(servicename)                 .setusernameandpassword(jidparts[0], password)                 .setconnecttimeout(3000)                 //.setdebuggerenabled(true)                 .setsecuritymode(connectionconfiguration.securitymode.required);          if (servicenameparts.length>1){             confbuilder.setresource(servicenameparts[1]);         } else {             confbuilder.setresource(long.tohexstring(double.doubletolongbits(math.random())));         }         if (hostname != null){             confbuilder.sethost(hostname);         }         if (port != null){             confbuilder.setport(port);         }         if (trustedhosts.contains(hostname) || (hostname == null && trustedhosts.contains(servicename))){             confbuilder.setcustomsslcontext(unsafesslcontext.instance.getcontext());         }         xmpptcpconnectionconfiguration connectionconfiguration = confbuilder.build();         xmpptcpconnection.setusestreammanagementdefault(true);         xmpptcpconnection.setusestreammanagementresumptiondefault(true);         connection = new xmpptcpconnection(connectionconfiguration);          // disable automatic roster request         roster roster = roster.getinstancefor(connection);         roster.setrosterloadedatlogin(false);         roster.setsubscriptionmode(roster.subscriptionmode.manual);          connection.addasyncstanzalistener(this, null);         connection.addconnectionlistener(this);         connection.addstanzaacknowledgedlistener(this);     }      @override     public void processpacket(stanza packet) throws smackexception.notconnectedexception {         logger.log(level.warning, "received stanza: " + packet);         this.xmppservicelistener.onstanza(packet);       } } 

belongs xep-0280 in smack, it's experimental feature. need additional library in build.gradle

dependencies {     compile "org.igniterealtime.smack:smack-android-extensions:4.2.0" } 

before thing smack, have initialize experimental feature:

new experimentalinitializer().initialize(); 

by way, provider plugin-like stanza handler when want use customized stanza between client , server. have write own provider parse extension element under message object. take @ providermanager.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -