当前位置: 首页>>代码示例>>Java>>正文


Java EntityFullJid类代码示例

本文整理汇总了Java中org.jxmpp.jid.EntityFullJid的典型用法代码示例。如果您正苦于以下问题:Java EntityFullJid类的具体用法?Java EntityFullJid怎么用?Java EntityFullJid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EntityFullJid类属于org.jxmpp.jid包,在下文中一共展示了EntityFullJid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: controlNotificationAlarm

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
private void controlNotificationAlarm(boolean torchMode) {
	final XMPPTCPConnection connection = mXmppManager.getXmppConnection();
	final EntityFullJid fullThingJid = mXmppManager.getFullThingJidOrNotify();
	if (fullThingJid == null) return;

	SetBoolData setTorch = new SetBoolData(Constants.NOTIFICATION_ALARM, torchMode);
	IoTControlManager ioTControlManager = IoTControlManager.getInstanceFor(connection);

	LOGGER.info("Trying to control " + fullThingJid + " set torchMode=" + torchMode);

	try {
		final IoTSetResponse ioTSetResponse = ioTControlManager.setUsingIq(fullThingJid, setTorch);
	} catch (SmackException.NoResponseException | XMPPErrorException | SmackException.NotConnectedException | InterruptedException e) {
		mXmppManager.withMainActivity((ma) -> Toast.makeText(mContext, "Could not control thing: " + e, Toast.LENGTH_LONG).show());
		LOGGER.log(Level.SEVERE, "Could not set data", e);
	}
}
 
开发者ID:Flowdalic,项目名称:android-xmpp-iot-demo,代码行数:18,代码来源:XmppIotDataControl.java

示例2: getFullThingJidOrNotify

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
EntityFullJid getFullThingJidOrNotify() {
	EntityBareJid thingJid = settings.getThingJid();
	IoTProvisioningManager ioTProvisioningManager = IoTProvisioningManager.getInstanceFor(xmppConnection);

	if (!ioTProvisioningManager.iAmFriendOf(thingJid)) {
		withMainActivity((ma) -> Toast.makeText(ma, "Can not perform action. Not befriended with thing", Toast.LENGTH_LONG).show());
		return null;
	}

	Presence presence = roster.getPresence(settings.getThingJid());
	if (presence == null || !presence.isAvailable()) {
		withMainActivity((ma) -> Toast.makeText(ma, "Can not perform action. Befriended with thing, but thing is not online/unavailable", Toast.LENGTH_LONG).show());
		return null;
	}

	EntityFullJid fullOtherJid = presence.getFrom().asEntityFullJidIfPossible();
	if (fullOtherJid == null) throw new IllegalStateException("Exepected full JID");
	return fullOtherJid;
}
 
开发者ID:Flowdalic,项目名称:android-xmpp-iot-demo,代码行数:20,代码来源:XmppManager.java

示例3: joined

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
@Override
public void joined(EntityFullJid entityFullJid) {
     XmppAddress xa = new XmppAddress(entityFullJid.toString());
     ChatGroup chatGroup = mChatGroupManager.getChatGroup(xa);
     MultiUserChat muc = mChatGroupManager.getMultiUserChat(entityFullJid.asBareJid().toString());

     Occupant occupant = muc.getOccupant(entityFullJid);
     Jid jidSource = (occupant != null) ? occupant.getJid() : null;
     if (jidSource != null)
     xa = new XmppAddress(jidSource.toString());
     else
     xa = new XmppAddress(entityFullJid.toString());

     Contact mucContact = new Contact(xa, xa.getUser(), Imps.Contacts.TYPE_NORMAL);
     chatGroup.notifyMemberJoined(entityFullJid.toString(),mucContact);
    if (occupant != null) {
        chatGroup.notifyMemberRoleUpdate(mucContact, occupant.getRole().name(), occupant.getAffiliation().toString());
    }
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:20,代码来源:XmppConnection.java

示例4: isParentOf

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
@Override
public final boolean isParentOf(Jid jid) {
	EntityFullJid fullJid = jid.asEntityFullJidIfPossible();
	if (fullJid != null) {
		return isParentOf(fullJid);
	}
	EntityBareJid bareJid = jid.asEntityBareJidIfPossible();
	if (bareJid != null) {
		return isParentOf(bareJid);
	}
	DomainFullJid domainFullJid = jid.asDomainFullJidIfPossible();
	if (domainFullJid != null) {
		return isParentOf(domainFullJid);
	}

	return isParentOf(jid.asDomainBareJid());
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:18,代码来源:AbstractJid.java

示例5: entityFullFrom

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
/**
 * Get a {@link EntityFullJid} representing the given String.
 *
 * @param jid the JID's String.
 * @return a full JID representing the input String.
 * @throws XmppStringprepException if an error occurs.
 */
public static EntityFullJid entityFullFrom(String jid) throws XmppStringprepException {
	EntityFullJid fullJid = ENTITY_FULLJID_CACHE.lookup(jid);
	if (fullJid != null) {
		return fullJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(jid);
	String domainpart = XmppStringUtils.parseDomain(jid);
	String resource = XmppStringUtils.parseResource(jid);
	try {
		fullJid = entityFullFrom(localpart, domainpart, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(jid, e);
	}
	ENTITY_FULLJID_CACHE.put(jid, fullJid);
	return fullJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:25,代码来源:JidCreate.java

示例6: entityFullFromUnescaped

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
/**
 * Get a {@link EntityFullJid} representing the given unescaped String.
 *
 * @param unescapedJidString the JID's String.
 * @return a full JID representing the input String.
 * @throws XmppStringprepException if an error occurs.
 */
public static EntityFullJid entityFullFromUnescaped(String unescapedJidString) throws XmppStringprepException {
	EntityFullJid fullJid = ENTITY_FULLJID_CACHE.lookup(unescapedJidString);
	if (fullJid != null) {
		return fullJid;
	}

	String localpart = XmppStringUtils.parseLocalpart(unescapedJidString);
	// Some as from(String), but we escape the localpart
	localpart = XmppStringUtils.escapeLocalpart(localpart);

	String domainpart = XmppStringUtils.parseDomain(unescapedJidString);
	String resource = XmppStringUtils.parseResource(unescapedJidString);
	try {
		fullJid = new LocalDomainAndResourcepartJid(localpart, domainpart, resource);
	} catch (XmppStringprepException e) {
		throw new XmppStringprepException(unescapedJidString, e);
	}

	ENTITY_FULLJID_CACHE.put(unescapedJidString, fullJid);
	return fullJid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:29,代码来源:JidCreate.java

示例7: performReadOut

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
private void performReadOut() {
	XMPPTCPConnection connection = mXmppManager.getXmppConnection();
	EntityFullJid fullThingJid = mXmppManager.getFullThingJidOrNotify();
	if (fullThingJid == null) return;

	LOGGER.info("Requesting read out from " + fullThingJid);

	IoTDataManager iotDataManager = IoTDataManager.getInstanceFor(connection);
	final List<IoTFieldsExtension> res;
	try {
		res = iotDataManager.requestMomentaryValuesReadOut(fullThingJid);
	} catch (SmackException.NoResponseException | XMPPErrorException | SmackException.NotConnectedException |InterruptedException e) {
		mXmppManager.withMainActivity((ma) -> Toast.makeText(mContext, "Could not perform read out: " + e, Toast.LENGTH_LONG).show());
		LOGGER.log(Level.WARNING, "Could not perform read out", e);
		return;
	}

	final List<? extends IoTDataField> dataFields = res.get(0).getNodes().get(0).getTimestampElements().get(0).getDataFields();

	mXmppManager.withMainActivity((ma) -> {
		ma.mIotSensorsLinearLayout.removeAllViews();
		for (IoTDataField field : dataFields) {
			IotSensorView iotSensorView = new IotSensorView(ma, field.getName(), field.getValueString());
			ma.mIotSensorsLinearLayout.addView(iotSensorView);
		}
	});
}
 
开发者ID:Flowdalic,项目名称:android-xmpp-iot-demo,代码行数:28,代码来源:XmppIotDataControl.java

示例8: left

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
@Override
public void left(EntityFullJid entityFullJid) {
     XmppAddress xa = new XmppAddress(entityFullJid.toString());
     ChatGroup chatGroup = mChatGroupManager.getChatGroup(xa);
     Contact mucContact = chatGroup.getMember(entityFullJid.toString());
     if (mucContact != null)
         chatGroup.notifyMemberRoleUpdate(mucContact, "none", null);
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:9,代码来源:XmppConnection.java

示例9: getOwnJID

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
/** The full JID of the user currently logged in. */
public Optional<JID> getOwnJID() {
    EntityFullJid user = mConn.getUser();
    if (user == null)
        return Optional.empty();
    return Optional.of(JID.fromSmack(user));
}
 
开发者ID:kontalk,项目名称:desktopclient-java,代码行数:8,代码来源:Client.java

示例10: filterEntityFullJid

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
/**
 * Filter all entity full JIDs.
 *
 * @param in the input collection.
 * @param out the collection where the filtered JIDs are added to.
 */
public static void filterEntityFullJid(Collection<? extends Jid> in, Collection<? super EntityFullJid> out) {
	for (Jid jid : in) {
		EntityFullJid fullJid = jid.asEntityFullJidIfPossible();
		if (fullJid != null) {
			out.add(fullJid);
		}
	}
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:15,代码来源:JidUtil.java

示例11: fullFromThrowTest

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
@Test
public void fullFromThrowTest() {
	final String notAFullJid = "[email protected]/";
	try {
		EntityFullJid jid = JidCreate.entityFullFrom(notAFullJid);
		// Should throw
		fail(jid + " should never been created");
	} catch (XmppStringprepException e) {
		assertEquals(notAFullJid, e.getCausingString());
	}
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:12,代码来源:JidCreateTest.java

示例12: entityFullFromComplexTest

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
@Test
public void entityFullFromComplexTest() throws XmppStringprepException {
	EntityFullJid entityFullJid = JidCreate.entityFullFrom("[email protected]@example.org/[email protected]");

	Domainpart domainpart = entityFullJid.getDomain();
	assertEquals(Domainpart.from("[email protected]"), domainpart);

	Localpart localpart = entityFullJid.getLocalpart();
	assertEquals(Localpart.from("foo"), localpart);

	Resourcepart resourcepart = entityFullJid.getResourcepart();
	assertEquals(Resourcepart.from("[email protected]"), resourcepart);
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:14,代码来源:JidCreateTest.java

示例13: entityFullFromUnsecapedComplexTest

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
@Test
public void entityFullFromUnsecapedComplexTest() throws XmppStringprepException {
	EntityFullJid entityFullJid = JidCreate.entityFullFromUnescaped("[email protected]@example.org/[email protected]");

	Domainpart domainpart = entityFullJid.getDomain();
	assertEquals(Domainpart.from("[email protected]"), domainpart);

	Localpart localpart = entityFullJid.getLocalpart();
	assertEquals(Localpart.from("foo"), localpart);

	Resourcepart resourcepart = entityFullJid.getResourcepart();
	assertEquals(Resourcepart.from("[email protected]"), resourcepart);
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:14,代码来源:JidCreateTest.java

示例14: kicked

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
@Override
public void kicked(EntityFullJid entityFullJid, Jid jid, String s) {
   //TODO figure out what to do here
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:5,代码来源:XmppConnection.java

示例15: membershipGranted

import org.jxmpp.jid.EntityFullJid; //导入依赖的package包/类
@Override
public void membershipGranted(EntityFullJid entityFullJid) {
        joined(entityFullJid);
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:5,代码来源:XmppConnection.java


注:本文中的org.jxmpp.jid.EntityFullJid类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。