Hi All,
Can someone please point me to sample packetextension code? I am working on a simple extension where I can send a URL as value in extension. I am able to send and recieve simple chat messages fine, but when I try to add a packet extension which contains a URL, user gets logged out of Jive server.
Any pointers will be a help.
Code snippet of how I send the message which results in log off
try
{
Chat chat = SOWClient.xmpCon.createChat(this.teamMember.getUser());
Message qceMessage = chat.createMessage();
QuickConfExtension qcePacket = new QuickConfExtension();
qcePacket.SetURL(“http:
www.xyz.com”);
qceMessage.addExtension(qcePacket);
qceMessage.setBody("");
qceMessage.setType(Message.Type.NORMAL);
qceMessage.setFrom("test@xyz.com");
chat.sendMessage(qceMessage);
}
catch (XMPPException xmpE)
{
}
/code
Code Snippet of my packet extension class
public class QuickConfExtension implements PacketExtension
{
private String url;
public QuickConfExtension()
{
}
public void SetURL(String newVal)
{
url=newVal;
}
public String getNamespace()
{
return “http:
www.xyz.com”;
}
public String getElementName()
{
return “QuickConfExtension”;
}
public String toXML()
{
String tmpXML;
tmpXML="<“getElementName()” xmlns="“getNamespace()”>";
tmpXML*=""*url+"";
return tmpXML;
}
}
/code