powered by Jive Software

A bug in smack / openfire

Hi,

Openfire / smack returning xmpp for gateway / transport for Gtalk instead of google or gtalk

Regards,

Samba

I am using the below code

 **public** **static** Hashtable<String, String> XMPPGetAvailableTransports(XMPPConnection connection)
        {
             ServiceDiscoveryManager manager = ServiceDiscoveryManager.getInstanceFor(connection);
             DiscoverItems items;
             **try**
             {
                  items = manager.discoverItems(connection.getServiceName());
             }
             **catch** (XMPPException e)
             {
                  items = **new** DiscoverItems();
             }
                
             Hashtable<String, String> availableTransports = **new** Hashtable<String, String>();
             Iterator<DiscoverItems.Item> iterator = items.getItems();
            
             **while**(iterator.hasNext())
             {
                  DiscoverItems.Item item = iterator.next();
                  **try**
                  {
                       DiscoverInfo info = manager.discoverInfo(item.getEntityID());
                       **if**(info.containsFeature("jabber:iq:gateway"))
                       {
                            Iterator<DiscoverInfo.Identity> identities = info.getIdentities();
                            **while**(identities.hasNext())
                            {
                                 DiscoverInfo.Identity identity = identities.next();

                                 **if** ("gateway".equals(identity.getCategory()))
                                 {
                                     String gatewayID    = item.getEntityID();
                                     String gatewayType = identity.getType();                                                                        
                                    
                                     **if**(gatewayID.indexOf("gtalk") > -1)
                                     {
                                         gatewayType = "gtalk";                                        
                                     }
                                    
                                     availableTransports.put(identity.getType(), item.getEntityID());                                                                         
                                     System.out.println(gatewayType+", " +gatewayID);
                                 }
                                    
                            }
                       }
                  }
                  **catch**(Exception e)
                  {
                  }             
             }
        
             **return** availableTransports;
        }

smack openfire should return transport name for gtalk as google or gtalk but it’s returning “XMPP”.

is that correct??