本文整理汇总了Java中rocks.xmpp.core.session.XmppClient类的典型用法代码示例。如果您正苦于以下问题:Java XmppClient类的具体用法?Java XmppClient怎么用?Java XmppClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XmppClient类属于rocks.xmpp.core.session包,在下文中一共展示了XmppClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendMessage
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public boolean sendMessage(String message) {
XmppClient client = api.getXMPPClient();
if(client.isConnected()) {
Message xmppMsg = new Message(contact.getJid(), Message.Type.CHAT, message);
client.sendMessage(xmppMsg);
return true;
}
return false;
}
示例2: accept
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public void accept() {
if(processed) {
throw new IllegalStateException("This request already was accepted/rejected!");
}
processed = true;
XmppClient client = api.getXMPPClient();
PresenceManager presenceManager = client.getManager(PresenceManager.class);
presenceManager.approveSubscription(from.getXMPPJid());
api.removeRequest(this);
}
示例3: deny
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public void deny() {
if(processed) {
throw new IllegalStateException("This request already was accepted/rejected!");
}
processed = true;
XmppClient client = api.getXMPPClient();
PresenceManager presenceManager = client.getManager(PresenceManager.class);
presenceManager.denySubscription(from.getXMPPJid());
api.removeRequest(this);
}
示例4: getXmppDetails
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public XmppDetails getXmppDetails(XmppAuthRequest authRequest) throws Exception {
//Authentication and BOSH pre-binding
BoshConnectionConfiguration boshConfiguration = BoshConnectionConfiguration.builder()
.hostname(xmppHost)
.port(Integer.valueOf(xmppPort))
.path(httpBind)
.wait(Integer.valueOf(waitTime))
.build();
XmppClient xmppClient = new XmppClient(xmppHost, boshConfiguration);
try {
xmppClient.connect(new Jid(authRequest.getJid()));
xmppClient.login(authRequest.getJid(), authRequest.getPassword());
rocks.xmpp.extensions.httpbind.BoshConnection boshConnection =
(rocks.xmpp.extensions.httpbind.BoshConnection) xmppClient.getActiveConnection();
String sessionId = boshConnection.getSessionId();
// Detaches the BOSH session, without terminating it.
long rid = boshConnection.detach();
XmppDetails details = new XmppDetails();
details.setJid(authRequest.getJid());
details.setSid(sessionId);
details.setRid(rid);
return details;
} catch (Exception e) {
LOG.error("Error", e);
}
return null;
}
示例5: create
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public static AbstractTestSuite create(Class <? extends AbstractTestSuite> clazz, Jid jid, String password) throws AbstractTestSuite.TestSuiteCreationException {
XmppSessionConfiguration configuration = XmppSessionConfiguration.builder()
.extensions(Extension.of(ClientStateIndication.class))
.initialPresence(null)
.build();
final XmppClient client = XmppClient.create(jid.getDomain(),configuration);
try {
AbstractTestSuite testSuite = clazz.getDeclaredConstructor(XmppClient.class, Jid.class, String.class).newInstance(client, jid, password);
return testSuite;
} catch (Exception e) {
e.printStackTrace();
throw new AbstractTestSuite.TestSuiteCreationException();
}
}
示例6: create
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public static AbstractTest create(Class <? extends AbstractTest> clazz, XmppClient client) throws TestCreationException {
if (client == null) {
throw new TestCreationException();
}
try {
AbstractTest test = clazz.getDeclaredConstructor(XmppClient.class).newInstance(client);
return test;
} catch (Exception e) {
e.printStackTrace();
throw new TestCreationException();
}
}
示例7: getXMPPClient
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public XmppClient getXMPPClient() {
return xmppClient;
}
示例8: Conversations
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public Conversations(XmppClient client, Jid jid, String password) {
super(client, jid, password);
}
示例9: AdvancedServerIM
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public AdvancedServerIM(XmppClient client, Jid jid, String password) {
super(client, jid, password);
}
示例10: AdvancedServerCore
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public AdvancedServerCore(XmppClient client, Jid jid, String password) {
super(client, jid, password);
}
示例11: AbstractTestSuite
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public AbstractTestSuite(XmppClient client, Jid jid, String password) {
mXmppClient = client;
mJid = jid;
mPassword = password;
}
示例12: AdvancedServerMobile
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public AdvancedServerMobile(XmppClient client, Jid jid, String password) {
super(client, jid, password);
}
示例13: MAM
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public MAM(XmppClient client) {
super(client);
}
示例14: AbstractStreamFeatureTest
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public AbstractStreamFeatureTest(XmppClient client) {
super(client);
}
示例15: AbstractTest
import rocks.xmpp.core.session.XmppClient; //导入依赖的package包/类
public AbstractTest(XmppClient client) {
this.client = client;
}