• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Jid类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: processRequest

import org.jxmpp.jid.Jid; //导入依赖的package包/类
@Override
public void processRequest(Jid from, Collection<SetData> setDatas) throws XMPPException.XMPPErrorException {
	SetBoolData flashControlData = null;
	for (SetData setData : setDatas) {
		if (!(setData instanceof  SetBoolData)) continue;
		if (!setData.getName().equals(Constants.NOTIFICATION_ALARM)) continue;
		flashControlData = (SetBoolData) setData;
		break;
	}

	if (flashControlData == null) {
		return;
	}

	if (flashControlData.getBooleanValue()) {
		setNotifcationAlarm(NotificationAlarm.on);
	} else {
		setNotifcationAlarm(NotificationAlarm.off);
	}
}
 
开发者ID:Flowdalic,项目名称:android-xmpp-iot-demo,代码行数:21,代码来源:XmppIotThing.java


示例2: rosterRequestNotification

import org.jxmpp.jid.Jid; //导入依赖的package包/类
public static void rosterRequestNotification(Jid sender) {
    // show notification only if the app is closed
    if (!MangostaApplication.getInstance().isClosed()) {
        new Event(Event.Type.PRESENCE_SUBSCRIPTION_REQUEST, sender).post();
        return;
    }

    Context context = XMPPSessionService.CONTEXT;
    String text = String.format(Locale.getDefault(), context.getString(R.string.roster_subscription_request), sender.toString());

    PendingIntent chatPendingIntent = preparePendingIntent(context, sender.toString());

    Notification.Builder mNotifyBuilder = new Notification.Builder(context)
            .setContentTitle(context.getString(R.string.roster_subscription_request_notification_title))
            .setContentText(text)
            .setSmallIcon(R.mipmap.ic_launcher_empty_back)
            .setContentIntent(chatPendingIntent)
            .setVibrate(new long[]{0, 200, 0, 200})
            .setAutoCancel(true)
            .setOngoing(true);

    NotificationManager mNotificationManager =
            (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.notify(sender.toString(), NotificationsControl.ROSTER_NOTIFICATION, mNotifyBuilder.build());
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:26,代码来源:RosterNotifications.java


示例3: sendBlogPostComment

import org.jxmpp.jid.Jid; //导入依赖的package包/类
public BlogPostComment sendBlogPostComment(String content, BlogPost blogPost)
        throws SmackException.NotConnectedException, InterruptedException,
        XMPPException.XMPPErrorException, SmackException.NoResponseException {
    Jid jid = XMPPSession.getInstance().getUser().asEntityBareJid();
    String userName = XMPPUtils.fromJIDToUserName(jid.toString());
    Jid pubSubServiceJid = XMPPSession.getInstance().getPubSubService();

    // create stanza
    PublishCommentExtension publishCommentExtension = new PublishCommentExtension(blogPost.getId(), userName, jid, content, new Date());
    PubSub publishCommentPubSub = PubSub.createPubsubPacket(pubSubServiceJid, IQ.Type.set, publishCommentExtension, null);

    // send stanza
    XMPPSession.getInstance().sendStanza(publishCommentPubSub);

    return new BlogPostComment(publishCommentExtension.getId(),
            blogPost.getId(),
            content,
            userName,
            jid.toString(),
            publishCommentExtension.getPublished());
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:22,代码来源:BlogPostDetailsActivity.java


示例4: manageCallFromRosterRequestNotification

import org.jxmpp.jid.Jid; //导入依赖的package包/类
private void manageCallFromRosterRequestNotification() {
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        boolean newRosterRequest = bundle.getBoolean(NEW_ROSTER_REQUEST, false);
        if (newRosterRequest) {
            try {
                String sender = bundle.getString(NEW_ROSTER_REQUEST_SENDER);
                Jid jid = JidCreate.from(sender);
                RosterNotifications.cancelRosterRequestNotification(this, sender);
                answerSubscriptionRequest(jid);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:17,代码来源:MainMenuActivity.java


示例5: getStatusFromContact

import org.jxmpp.jid.Jid; //导入依赖的package包/类
public Presence.Type getStatusFromContact(String name) {
    try {
        HashMap<Jid, Presence.Type> buddies = getContacts();

        for (Map.Entry<Jid, Presence.Type> pair : buddies.entrySet()) {
            if (XMPPUtils.fromJIDToUserName(pair.getKey().toString()).equals(name)) {
                return pair.getValue();
            }
        }

    } catch (Exception e) {
        e.printStackTrace();
    }

    return Presence.Type.unavailable;
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:17,代码来源:RosterManager.java


示例6: checkXMPPLoggedUserSaved

import org.jxmpp.jid.Jid; //导入依赖的package包/类
@Test
public void checkXMPPLoggedUserSaved() throws Exception {
    assumeTrue(isUserLoggedIn());

    IdlingResource resource = startTiming(SplashActivity.WAIT_TIME);

    assumeNotNull(XMPPSession.getInstance().getXMPPConnection());
    assumeNotNull(XMPPSession.getInstance().getXMPPConnection().getUser());

    Jid jid = XMPPSession.getInstance().getXMPPConnection().getUser().asBareJid();
    assertTrue(XMPPUtils.isAutenticatedJid(jid));

    String userName = XMPPUtils.fromJIDToUserName(jid.toString());
    assertTrue(XMPPUtils.isAutenticatedUser(userName));

    stopTiming(resource);
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:18,代码来源:LoginInstrumentedTest.java


示例7: joined

import org.jxmpp.jid.Jid; //导入依赖的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


示例8: resourceSupportsOmemo

import org.jxmpp.jid.Jid; //导入依赖的package包/类
@Override
public boolean resourceSupportsOmemo(Jid jid) {

    try {
        if (mConnection == null || getState() != ImConnection.LOGGED_IN)
            return false;

        if (getOmemo().resourceSupportsOmemo(jid)) {

      //      if (getOmemo().getFingerprints(jid.asBareJid(), false).size() == 0) {
           //     getOmemo().getManager().requestDeviceListUpdateFor(jid.asBareJid());
            //    return false;
        //    }

            return true;
        }

    }
    catch (Exception e)
    {
        debug("OMEMO","There was a problem checking the resource",e);
    }

    return false;
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:26,代码来源:XmppConnection.java


示例9: entriesDeleted

import org.jxmpp.jid.Jid; //导入依赖的package包/类
@Override
public void entriesDeleted(Collection<Jid> addresses) {

    ContactList cl;
    try {
        cl = mContactListManager.getDefaultContactList();

        for (Jid address : addresses) {
            Contact contact = new Contact(new XmppAddress(address.toString()),address.toString(), Imps.Contacts.TYPE_NORMAL);
            mContactListManager.notifyContactListUpdated(cl, ContactListListener.LIST_CONTACT_REMOVED, contact);
        }


    } catch (ImException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:20,代码来源:XmppConnection.java


示例10: setPresence

import org.jxmpp.jid.Jid; //导入依赖的package包/类
private void setPresence (Jid from, int presenceType) {

        Presence p = null;
        Contact contact = mContactListManager.getContact(from.asBareJid().toString());
        if (contact == null)
            return;

        p = new Presence(presenceType, "", null, null,
                Presence.CLIENT_TYPE_MOBILE);

        if (from.hasResource())
            p.setResource(from.getResourceOrEmpty().toString());

        if (presenceType == Presence.AVAILABLE)
            p.setLastSeen(new Date());
        else if (contact.getPresence() != null)
            p.setLastSeen(contact.getPresence().getLastSeen());

        contact.setPresence(p);
        Collection<Contact> contactsUpdate = new ArrayList<Contact>();
        contactsUpdate.add(contact);
        mContactListManager.notifyContactsPresenceUpdated(contactsUpdate.toArray(new Contact[contactsUpdate.size()]));



    }
 
开发者ID:zom,项目名称:Zom-Android,代码行数:27,代码来源:XmppConnection.java


示例11: handleSubscribeRequest

import org.jxmpp.jid.Jid; //导入依赖的package包/类
private void handleSubscribeRequest (Jid jid) throws ImException, RemoteException {
    ContactList cList = getContactListManager().getDefaultContactList();

    XmppAddress xAddr = new XmppAddress(jid.toString());
    Contact contact = new Contact(xAddr, xAddr.getUser(), Imps.Contacts.TYPE_NORMAL);
    mContactListManager.doAddContactToListAsync(contact, cList, false);

    mContactListManager.getSubscriptionRequestListener().onSubScriptionRequest(contact, mProviderId, mAccountId);

    ChatSession session = findOrCreateSession(jid.toString(), false);

    org.jivesoftware.smack.packet.Message msg = new org.jivesoftware.smack.packet.Message();
    msg.setStanzaId((Math.random()*10000f)+"subscribe");
    msg.setTo(mUserJid);
    msg.setFrom(jid);
    String message = mContext.getString(R.string.subscription_notify_text, contact.getName());
    msg.setBody(message);
    handleMessage(msg, false, false);

}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:21,代码来源:XmppConnection.java


示例12: getChatSessionManager

import org.jxmpp.jid.Jid; //导入依赖的package包/类
@Override
public ChatSessionManager getChatSessionManager() {
    return new ChatSessionManager() {

        @Override
        public void sendMessageAsync(ChatSession session, Message message) {
            // Echo
            Message rec = new Message(message.getBody());
            rec.setFrom(message.getTo());
            rec.setDateTime(new Date());
            session.onReceiveMessage(rec, true);
        }

        @Override
        public boolean resourceSupportsOmemo(Jid jid) {
            return false;
        }
    };
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:20,代码来源:LoopbackConnection.java


示例13: entriesUpdated

import org.jxmpp.jid.Jid; //导入依赖的package包/类
@Override
public void entriesUpdated(Collection<Jid> addresses) {
    final MessageCenterService service = mService.get();
    final PresenceListener presenceListener = mPresenceListener.get();
    if (service == null || presenceListener == null)
        return;

    // we got an updated roster entry
    // check if it's a subscription "both"
    for (Jid jid : addresses) {
        RosterEntry e = service.getRosterEntry(jid.asBareJid());
        if (e != null && e.canSeeHisPresence()) {
            userSubscribed(service, presenceListener, jid);
        }
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:17,代码来源:RosterListener.java


示例14: entriesAdded

import org.jxmpp.jid.Jid; //导入依赖的package包/类
/**
 * NOTE: on every (re-)connect all entries are added again (loaded),
 * one method call for all contacts.
 */
@Override
public void entriesAdded(Collection<Jid> addresses) {
    if (mRoster == null || !mLoaded)
        return;

    for (Jid jid: addresses) {
        RosterEntry entry = mRoster.getEntry(jid.asBareJid());
        if (entry == null) {
            LOGGER.warning("jid not in roster: "+jid);
            return;
        }

        LOGGER.config("entry: "+entry.toString());
        mHandler.onEntryAdded(clientToModel(entry));
    }
}
 
开发者ID:kontalk,项目名称:desktopclient-java,代码行数:21,代码来源:KonRosterListener.java


示例15: initiateSession

import org.jxmpp.jid.Jid; //导入依赖的package包/类
/**
 * Sends 'session-initiate' to the peer identified by given <tt>address</tt>
 *
 * @param useBundle <tt>true</tt> if invite IQ should include
 *                  {@link GroupPacketExtension}
 * @param address the XMPP address where 'session-initiate' will be sent.
 * @param contents the list of <tt>ContentPacketExtension</tt> describing
 *                 media offer.
 * @param requestHandler <tt>JingleRequestHandler</tt> that will be used
 *                       to process request related to newly created
 *                       JingleSession.
 * @param startMuted if the first element is <tt>true</tt> the participant
 * will start audio muted. if the second element is <tt>true</tt> the
 * participant will start video muted.
 * {@inheritDoc}
 */
@Override
public boolean initiateSession(boolean                      useBundle,
                               Jid                          address,
                               List<ContentPacketExtension> contents,
                               JingleRequestHandler         requestHandler,
                               boolean[]                    startMuted)
    throws OperationFailedException
{
    logger.info("INVITE PEER: " + address);

    String sid = JingleIQ.generateSID();
    JingleSession session = new JingleSession(sid, address, requestHandler);

    sessions.put(sid, session);

    JingleIQ inviteIQ
        = createInviteIQ(JingleAction.SESSION_INITIATE,
            sid, useBundle, address, contents, startMuted);

    IQ reply = (IQ) getConnection().sendPacketAndGetReply(inviteIQ);

    return wasInviteAccepted(session, reply);
}
 
开发者ID:jitsi,项目名称:jicofo,代码行数:40,代码来源:AbstractOperationSetJingle.java


示例16: jidsFrom

import org.jxmpp.jid.Jid; //导入依赖的package包/类
/**
 * Convert a collection of Strings to a Set of {@link Jid}'s.
 * <p>
 * If the optional argument <code>exceptions</code> is given, then all {@link XmppStringprepException} thrown while
 * converting will be added to the list. Otherwise, if an XmppStringprepExceptions is thrown, it will be wrapped in
 * a AssertionError Exception and throw.
 * </p>
 * 
 * @param jidStrings
 *            the strings that are going to get converted
 * @param output
 *            the collection where the Jid's will be added to
 * @param exceptions the list of exceptions thrown while converting.
 */
public static void jidsFrom(Collection<? extends CharSequence> jidStrings, Collection<? super Jid> output,
		List<XmppStringprepException> exceptions) {
	for (CharSequence jidString : jidStrings) {
		try {
			Jid jid = JidCreate.from(jidString);
			output.add(jid);
		} catch (XmppStringprepException e) {
			if (exceptions != null) {
				exceptions.add(e);
			} else {
				throw new AssertionError(e);
			}
		}
	}
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:30,代码来源:JidUtil.java


示例17: isParentOf

import org.jxmpp.jid.Jid; //导入依赖的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


示例18: from

import org.jxmpp.jid.Jid; //导入依赖的package包/类
/**
 * Get a {@link Jid} from the given parts.
 * <p>
 * Only the domainpart is required.
 * </p>
 *
 * @param localpart a optional localpart.
 * @param domainpart a required domainpart.
 * @param resource a optional resourcepart.
 * @return a JID which consists of the given parts.
 * @throws XmppStringprepException if an error occurs.
 */
public static Jid from(String localpart, String domainpart, String resource) throws XmppStringprepException {
	String jidString = XmppStringUtils.completeJidFrom(localpart, domainpart, resource);
	Jid jid = JID_CACHE.lookup(jidString);
	if (jid != null) {
		return jid;
	}
	if (localpart.length() > 0 && domainpart.length() > 0 && resource.length() > 0) {
		jid = new LocalDomainAndResourcepartJid(localpart, domainpart, resource);
	} else if (localpart.length() > 0 && domainpart.length() > 0 && resource.length() == 0) {
		jid = new LocalAndDomainpartJid(localpart, domainpart);
	} else if (localpart.length() == 0 && domainpart.length() > 0 && resource.length() == 0) {
		jid = new DomainpartJid(domainpart);
	} else if (localpart.length() == 0 && domainpart.length() > 0 && resource.length() > 0) {
		jid = new DomainAndResourcepartJid(domainpart, resource);
	} else {
		throw new IllegalArgumentException("Not a valid combination of localpart, domainpart and resource");
	}
	JID_CACHE.put(jidString, jid);
	return jid;
}
 
开发者ID:igniterealtime,项目名称:jxmpp,代码行数:33,代码来源:JidCreate.java


示例19: newConnection

import org.jxmpp.jid.Jid; //导入依赖的package包/类
@Override
public void newConnection(XMPPConnection connection) {
	mConnection = connection;
	mRoster = Roster.getInstanceFor(connection);
	mRoster.addRosterListener(this);

	mRoster.addSubscribeListener(new SubscribeListener() {
		@Override
		public SubscribeAnswer processSubscribe(Jid from, Presence subscribeRequest) {
			Set<EntityBareJid> masterJids = mSettings.getMasterJids();
			for (EntityBareJid masterJid : masterJids) {
				if (masterJid.equals(from)) {
					return SubscribeAnswer.Approve;
				}
			}
			return SubscribeAnswer.Deny;
		}
	});
}
 
开发者ID:ProjectMAXS,项目名称:maxs,代码行数:20,代码来源:XMPPRoster.java


示例20: send

import org.jxmpp.jid.Jid; //导入依赖的package包/类
public void send(Jid to, String body) {
	switch (mState) {
	case Disconnected:
	case Disconnecting:
		LOG.w("Transport is disconnected, not going to send message to " + to);
		return;
	default:
		break;
	}
	if (!shouldUseXmppConnection()) {
		LOG.w("Connection is not connected and no resumption possible, not going to send message to "
				+ to);
		return;
	}
	Message message = new Message();
	message.setTo(to);
	message.setBody(body);
	try {
		mConnection.sendStanza(message);
	} catch (InterruptedException | NotConnectedException e) {
		LOG.w("send", e);
	}
}
 
开发者ID:ProjectMAXS,项目名称:maxs,代码行数:24,代码来源:XMPPService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FSEditLogOpCodes类代码示例发布时间:2022-05-22
下一篇:
Java Info类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap