org.littleshoot.commom.xmpp
Class XmppUtils

java.lang.Object
  extended by org.littleshoot.commom.xmpp.XmppUtils

public class XmppUtils
extends Object


Method Summary
static org.jivesoftware.smack.packet.Packet discoveryRequest(org.jivesoftware.smack.XMPPConnection conn)
           
static org.jivesoftware.smack.packet.RosterPacket extendedRoster(org.jivesoftware.smack.XMPPConnection conn)
           
static String extractFrom(Document doc)
           
static String extractSdp(Document doc)
           
static Collection<InetSocketAddress> extractStunServers(String xml)
          Extracts STUN servers from a response from Google Talk containing those servers.
static long extractTransactionId(Document doc)
           
static org.jivesoftware.smack.ConnectionConfiguration getGlobalConfig()
           
static org.jivesoftware.smack.ConnectionConfiguration getGlobalProxyConfig()
           
static org.jivesoftware.smack.packet.Packet getOtr(org.jivesoftware.smack.XMPPConnection conn)
           
static org.jivesoftware.smack.packet.Packet getSharedStatus(org.jivesoftware.smack.XMPPConnection conn)
           
static org.jivesoftware.smackx.packet.VCard getVCard(org.jivesoftware.smack.XMPPConnection conn, String emailId)
           
static org.jivesoftware.smack.packet.Packet goOffTheRecord(String jidToOtr, org.jivesoftware.smack.XMPPConnection conn)
           
static Collection<InetSocketAddress> googleStunServers(org.jivesoftware.smack.XMPPConnection conn)
           
static org.jivesoftware.smack.packet.Packet goOnTheRecord(String jidToOtr, org.jivesoftware.smack.XMPPConnection conn)
           
static String jidToUser(String jid)
           
static String jidToUser(org.jivesoftware.smack.XMPPConnection conn)
           
static org.jivesoftware.smack.XMPPConnection persistentXmppConnection(String username, String password, String id, int attempts)
           
static org.jivesoftware.smack.XMPPConnection persistentXmppConnection(String username, String password, String id, int attempts, String host, int port, String serviceName, XmppP2PClient clientListener)
           
static org.jivesoftware.smack.XMPPConnection persistentXmppConnection(XmppCredentials credentials, int attempts, String host, int port, String serviceName, XmppP2PClient clientListener)
           
static void printMessage(org.jivesoftware.smack.packet.Packet msg)
           
static void setGlobalConfig(org.jivesoftware.smack.ConnectionConfiguration config)
           
static void setGlobalProxyConfig(org.jivesoftware.smack.ConnectionConfiguration config)
           
static void setGoogleTalkInvisible(org.jivesoftware.smack.XMPPConnection conn, String to)
          Note we don't even need to set this property to maintain compatibility with Google Talk presence -- just sending them the shared status message signifies we generally understand the protocol and allows us to not clobber other clients' presences.
static org.jivesoftware.smack.XMPPConnection simpleGoogleTalkConnection(String username, String password, String id)
           
static org.jivesoftware.smack.XMPPConnection simpleGoogleTalkConnection(XmppCredentials credentials)
           
static String toString(org.jivesoftware.smack.packet.Packet msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

extractStunServers

public static Collection<InetSocketAddress> extractStunServers(String xml)
Extracts STUN servers from a response from Google Talk containing those servers.

Parameters:
xml - The XML with server data.
Returns:
The servers.

extractSdp

public static String extractSdp(Document doc)

extractTransactionId

public static long extractTransactionId(Document doc)

extractFrom

public static String extractFrom(Document doc)

printMessage

public static void printMessage(org.jivesoftware.smack.packet.Packet msg)

toString

public static String toString(org.jivesoftware.smack.packet.Packet msg)

persistentXmppConnection

public static org.jivesoftware.smack.XMPPConnection persistentXmppConnection(String username,
                                                                             String password,
                                                                             String id,
                                                                             int attempts)
                                                                      throws IOException,
                                                                             CredentialException
Throws:
IOException
CredentialException

persistentXmppConnection

public static org.jivesoftware.smack.XMPPConnection persistentXmppConnection(String username,
                                                                             String password,
                                                                             String id,
                                                                             int attempts,
                                                                             String host,
                                                                             int port,
                                                                             String serviceName,
                                                                             XmppP2PClient clientListener)
                                                                      throws IOException,
                                                                             CredentialException
Throws:
IOException
CredentialException

persistentXmppConnection

public static org.jivesoftware.smack.XMPPConnection persistentXmppConnection(XmppCredentials credentials,
                                                                             int attempts,
                                                                             String host,
                                                                             int port,
                                                                             String serviceName,
                                                                             XmppP2PClient clientListener)
                                                                      throws IOException,
                                                                             CredentialException
Throws:
IOException
CredentialException

setGlobalConfig

public static void setGlobalConfig(org.jivesoftware.smack.ConnectionConfiguration config)

getGlobalConfig

public static org.jivesoftware.smack.ConnectionConfiguration getGlobalConfig()

setGlobalProxyConfig

public static void setGlobalProxyConfig(org.jivesoftware.smack.ConnectionConfiguration config)

getGlobalProxyConfig

public static org.jivesoftware.smack.ConnectionConfiguration getGlobalProxyConfig()

simpleGoogleTalkConnection

public static org.jivesoftware.smack.XMPPConnection simpleGoogleTalkConnection(String username,
                                                                               String password,
                                                                               String id)
                                                                        throws CredentialException,
                                                                               org.jivesoftware.smack.XMPPException,
                                                                               IOException
Throws:
CredentialException
org.jivesoftware.smack.XMPPException
IOException

simpleGoogleTalkConnection

public static org.jivesoftware.smack.XMPPConnection simpleGoogleTalkConnection(XmppCredentials credentials)
                                                                        throws CredentialException,
                                                                               org.jivesoftware.smack.XMPPException,
                                                                               IOException
Throws:
CredentialException
org.jivesoftware.smack.XMPPException
IOException

jidToUser

public static String jidToUser(String jid)

jidToUser

public static String jidToUser(org.jivesoftware.smack.XMPPConnection conn)

getVCard

public static org.jivesoftware.smackx.packet.VCard getVCard(org.jivesoftware.smack.XMPPConnection conn,
                                                            String emailId)
                                                     throws org.jivesoftware.smack.XMPPException
Throws:
org.jivesoftware.smack.XMPPException

goOffTheRecord

public static org.jivesoftware.smack.packet.Packet goOffTheRecord(String jidToOtr,
                                                                  org.jivesoftware.smack.XMPPConnection conn)

goOnTheRecord

public static org.jivesoftware.smack.packet.Packet goOnTheRecord(String jidToOtr,
                                                                 org.jivesoftware.smack.XMPPConnection conn)

getOtr

public static org.jivesoftware.smack.packet.Packet getOtr(org.jivesoftware.smack.XMPPConnection conn)

getSharedStatus

public static org.jivesoftware.smack.packet.Packet getSharedStatus(org.jivesoftware.smack.XMPPConnection conn)

extendedRoster

public static org.jivesoftware.smack.packet.RosterPacket extendedRoster(org.jivesoftware.smack.XMPPConnection conn)

googleStunServers

public static Collection<InetSocketAddress> googleStunServers(org.jivesoftware.smack.XMPPConnection conn)

discoveryRequest

public static org.jivesoftware.smack.packet.Packet discoveryRequest(org.jivesoftware.smack.XMPPConnection conn)

setGoogleTalkInvisible

public static void setGoogleTalkInvisible(org.jivesoftware.smack.XMPPConnection conn,
                                          String to)
Note we don't even need to set this property to maintain compatibility with Google Talk presence -- just sending them the shared status message signifies we generally understand the protocol and allows us to not clobber other clients' presences.

Parameters:
conn -
to -


Copyright © 2014 LittleShoot. All Rights Reserved.