powered by Jive Software

Posting Hyperlinks in GTalk

How Do I pre-parse a url so that it is clickable on the chat window of GTalk ?

I mean sending a message like Google to the chat using the API does not become a hyperlink…

But when I type it in the chat window, www.google.com automatically becomes a hyperlink and is clickable !

Any ideas ?

What method do you use ?

Hi Konstantin,

I am using smack and the org.jivesoftware.smack.XMPPConnection’s sendPacket(reply) method

The reply is of type org.jivesoftware.smack.packet.Message

P.S: I noticed that I am also not able to post emoticons… i mean : D appears like that and does not turn into a whan i send it using the above method… am I missing something here ? btw, I am using the MessageParrot Example …

Any leads ?

Jabber server didn’t send emoticons as images. It send text ( like : D ) And client converts it into image. Hyberlinks works same.

Look at org.jivesoftware.spark.ui.ChatInputEditor or org.jivesoftware.spark.ui.TranscriptWindow classes. there you will find some info & functionality.

That is fine, but the hyperlinks are not working…

if I send www.google.com in the org.jivesoftware.smack.XMPPConnection’s sendPacket(reply) method like…

Message replyback = new Message();




When this comes up in the chat window of the client, there is no hyperlink here…

Message replyback = new Message();


replyback.setBody("<a href=“www.google.com”>Google");


When this is sent, the chat window again displays Google , but still no hyperlinks …

What should I do so that the GTalk chat-window renders it as a hyperlink ??

try something like http://www.google.com

Nope, that’s not working either…

Maybe it has got to do something with the reply type ?

Hmm. I’m looking in logs. My Spark converts links like www.google.com & http://www.google.com. What spark version do you use ?

I am using the latest version…

this is my code… I jus want to know why this does not work…

Forgot to add this piece:

import org.jivesoftware.smack.ConnectionConfiguration;

import org.jivesoftware.smack.PacketListener;

import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.XMPPException;

import org.jivesoftware.smack.filter.MessageTypeFilter;

import org.jivesoftware.smack.filter.PacketFilter;

import org.jivesoftware.smack.packet.Message;

import org.jivesoftware.smack.packet.Packet;

import org.jivesoftware.smack.packet.Presence;

import org.jivesoftware.smack.util.StringUtils;

public static void main( String[] args ) {


ConnectionConfiguration connConfig = new ConnectionConfiguration("

talk.google.com", 5222, “gmail.com”);

XMPPConnection connection = new XMPPConnection(connConfig);

try {


System.out.println("Connected to " + connection.getHost());

} catch (XMPPException ex) {


System.out.println("Failed to connect to " +




try {

connection.login(username, password);

System.out.println("Logged in as " + connection.getUser());

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


} catch (XMPPException ex) {

System.out.println("Failed to log in as " + username);



PacketFilter filter = new MessageTypeFilter(Message.Type.chat);

connection.addPacketListener(new MessageParrot(connection), filter);

if(args.length > 0) {

// google bounces back the default message types, you must use


Message msg = new Message(args[0], Message.Type.chat);




System.out.println(“Press enter to disconnect\n”);

try {


} catch (IOException ex) {





public void processPacket(Packet packet) {

Message message = (Message)packet;

if(message.getBody() != null) {

String fromName =


Message reply = new Message();


String messageString = message.getBody();






public static class MessageParrot implements PacketListener {

private XMPPConnection xmppConnection;

public MessageParrot(XMPPConnection conn) {

xmppConnection = conn;


On Mon, Jan 11, 2010 at 10:40 PM, Vaidyanathan S <