Not logged in to transport?

Hello,

I’m using the Smack API to connect to an Openfire server with the IM Gateway plugin. I’ve registered a user and a Yahoo gateway for that user, but whenever I send a message to a Yahoo account via the gateway I get:

“You are not currently logged in to the YAHOO transport”

I didn’t see anything in the javadoc about how to log in to a transport, but I do see that Spark does it. It seems like this article:

http://www.igniterealtime.org/community/docs/DOC-1004

describes my problem, but I guess I don’t really understand how to implement the solution with the Smack API.

How did you register? If you used Spark, then you registered in a way that you have to do extra work. If you register via the admin interface, then it’s much more simple to work with. =)

Thanks for your prompt reply.

I registered with the admin UI. I don’t need to have the program register itself.

The icon next to the registration remains gray when I connect using Smack, but it turns red (auto login?) when I use Spark, logging in as the same user. When using Spark, I get the messages in my Yahoo client, so I’m assuming that the registration, Openfire, and the IM Gateway plugin are all working and that it is my code that is the problem. Sending messages to local users on the Openfire servier works fine.

I’ve been using this basic sequence in my code:

  1. Connect then login

  2. Set the roster to auto subscribe

  3. If the Yahoo user isn’t in the roster, add them.

  4. Create a chat and send a message to the Yahoo user, add a listener as well.

When I get to step 4, I get the aforementioned error as a Message packet from the server.

BTW, I checked the config and auto-login is enabled. It’s just not logging in to Yahoo when I send messages using Smack.

Maybe I need to send a Presence packet as the XMPP id of the gateway registration to get the gateway to do ‘auto login’? e.g. someuser@yahoo.my-server

So I took a look at the Spark sources… Does GatewayPrivateData have anything to do with it?

Okay, I tried sending a Presence message to the transport service (yahoo.), and that wakes it up… but after a while I get the same message after a while.

So… any ideas?

Here is what seems to work for me:

  1. Connect and login the usual way.

  2. Get a ServiceDiscoveryManager using ServiceDiscoveryManager.getInstanceFor(connection);

  3. Iterate through the discovery items to get the transport entity IDs:

discoverItems = disco.discoverItems(connection.getServiceName());

Iterator items = discoItems.getItems();

Set<String> transports = new HashSet<String>();

while (items.hasNext())

{

item = (DiscoverItems.Item) items.next();

String entityName = item.getEntityID();

if (entityName != null)

{

if (entityName.startsWith(“aim.”))

{

transports.add(entityName);

}

else if (entityName.startsWith(“msn.”))

{

transports.add(entityName);

}

else if (entityName.startsWith(“yahoo.”))

{

transports.add(entityName);

}

else if (entityName.startsWith(“icq.”))

{

transports.add(entityName);

}

else if (entityName.startsWith(“gtalk.”))

{

transports.add(entityName);

}

else if (entityName.startsWith(“xmpp.”))

{

transports.add(entityName);

}

else if (entityName.startsWith(“irc.”))

{

transports.add(entityName);

}

else if (entityName.startsWith(“sip.”))

{

transports.add(entityName);

}

else if (entityName.startsWith(“gadugadu.”))

{

transports.add(entityName);

}

else if (entityName.startsWith(“qq.”))

{

transports.add(entityName);

}

}

} // while

  1. Send a Presence packet:

for (String xmppid : transports) {

Presence p = new Presence(Presence.Type.available);

p.setTo(xmppId);

connection.sendPacket§;

}

In practice I don’t send that unless the transport is not available.

Hi josuha,

Me too facing the same issue, I can send IM only by setting presence status, But my account have more than 50 or 100 contacts. It will long time to set the presence.

Is there any way to send IM without setting Presence.

My sever installed with Openfire and IM gateway plugin.

Regards,

Veeraa.

i’m having the same problem also…

any help would be greatly appreciated

i know the gateway is online because i can use spark to send the message but for some reason

smack just keep saying that i’m not connected to the transport

thank you,

tom

I have exactly the same problem, please do you have any idea for solving?