當前位置: 首頁>>代碼示例>>Java>>正文


Java XMPPException.XMPPErrorException方法代碼示例

本文整理匯總了Java中org.jivesoftware.smack.XMPPException.XMPPErrorException方法的典型用法代碼示例。如果您正苦於以下問題:Java XMPPException.XMPPErrorException方法的具體用法?Java XMPPException.XMPPErrorException怎麽用?Java XMPPException.XMPPErrorException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jivesoftware.smack.XMPPException的用法示例。


在下文中一共展示了XMPPException.XMPPErrorException方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processRequest

import org.jivesoftware.smack.XMPPException; //導入方法依賴的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: sendBlogPostComment

import org.jivesoftware.smack.XMPPException; //導入方法依賴的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

示例3: removeContact

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
public void removeContact(String jidString)
        throws SmackException.NotLoggedInException, InterruptedException,
        SmackException.NotConnectedException, XMPPException.XMPPErrorException,
        SmackException.NoResponseException, XmppStringprepException {
    Roster roster = Roster.getInstanceFor(XMPPSession.getInstance().getXMPPConnection());
    if (!roster.isLoaded()) {
        roster.reloadAndWait();
    }

    BareJid jid = JidCreate.bareFrom(jidString);
    roster.removeEntry(roster.getEntry(jid));

    Presence presence = new Presence(Presence.Type.unsubscribe);
    presence.setTo(JidCreate.from(jidString));
    XMPPSession.getInstance().sendStanza(presence);
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:17,代碼來源:RosterManager.java

示例4: addContact

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
public void addContact(String jidString)
        throws SmackException.NotLoggedInException, InterruptedException,
        SmackException.NotConnectedException, XMPPException.XMPPErrorException,
        SmackException.NoResponseException, XmppStringprepException {
    Roster roster = Roster.getInstanceFor(XMPPSession.getInstance().getXMPPConnection());
    if (!roster.isLoaded()) {
        roster.reloadAndWait();
    }

    BareJid jid = JidCreate.bareFrom(jidString);
    String name = XMPPUtils.fromJIDToUserName(jidString);
    String[] groups = new String[]{"Buddies"};

    roster.createEntry(jid, name, groups);
    roster.sendSubscriptionRequest(jid);
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:17,代碼來源:RosterManager.java

示例5: claimButtonClicked

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
private void claimButtonClicked(final Thing thing) {

		final XMPPTCPConnection connection = mXmppManger.getXmppConnection();
		if (connection == null) {
			showInGui("Not connection available");
			return;
		}

		if (!connection.isAuthenticated()) {
			showInGui("Connection not authenticated");
			return;
		}

		IoTDiscoveryManager ioTDiscoveryManager = IoTDiscoveryManager.getInstanceFor(connection);

		IoTClaimed iotClaimed;
		try {
			iotClaimed = ioTDiscoveryManager.claimThing(mRegistry, thing.getMetaTags(), true);
		} catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | InterruptedException e) {
			showInGui("Could not claim because " + e);
			LOGGER.log(Level.WARNING, "Could not register", e);
			return;
		}

		EntityBareJid claimedJid = iotClaimed.getJid().asEntityBareJidIfPossible();
		if (claimedJid == null) {
			throw new IllegalStateException();
		}
		Settings settings = Settings.getInstance(this);
		settings.setClaimedJid(claimedJid);

		showInGui("Thing " + claimedJid + " claimed.");
		runOnUiThread(() -> {
			finish();
		});
	}
 
開發者ID:Flowdalic,項目名稱:android-xmpp-iot-demo,代碼行數:37,代碼來源:ClaimThingActivity.java

示例6: removeChatGuyFromContacts

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
private void removeChatGuyFromContacts() {
    User userNotContact = new User();
    userNotContact.setLogin(XMPPUtils.fromJIDToUserName(mChat.getJid()));
    try {
        RosterManager.getInstance().removeContact(userNotContact);
        setMenuChatNotContact();
        Toast.makeText(this, String.format(Locale.getDefault(), getString(R.string.user_removed_from_contacts),
                userNotContact.getLogin()), Toast.LENGTH_SHORT).show();
    } catch (SmackException.NotLoggedInException | InterruptedException |
            SmackException.NotConnectedException | XMPPException.XMPPErrorException |
            XmppStringprepException | SmackException.NoResponseException e) {
        e.printStackTrace();
    }
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:15,代碼來源:ChatActivity.java

示例7: addChatGuyToContacts

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
private void addChatGuyToContacts() {
    User userContact = new User();
    userContact.setLogin(XMPPUtils.fromJIDToUserName(mChat.getJid()));
    try {
        RosterManager.getInstance().addContact(userContact);
        setMenuChatWithContact();
        Toast.makeText(this, String.format(Locale.getDefault(), getString(R.string.user_added_to_contacts),
                userContact.getLogin()), Toast.LENGTH_SHORT).show();
    } catch (SmackException.NotLoggedInException | InterruptedException | SmackException.NotConnectedException | XMPPException.XMPPErrorException | XmppStringprepException | SmackException.NoResponseException e) {
        e.printStackTrace();
    }
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:13,代碼來源:ChatActivity.java

示例8: getChatMembers

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
private void getChatMembers()
        throws SmackException.NoResponseException, XMPPException.XMPPErrorException,
        SmackException.NotConnectedException, InterruptedException, XmppStringprepException {
    List<String> jids = RoomManager.getInstance(null).loadMUCLightMembers(mChatJID);
    for (String jid : jids) {
        membersObtainUser(XMPPUtils.fromJIDToUserName(jid));
    }
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:9,代碼來源:EditChatMemberActivity.java

示例9: getSubject

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
private void getSubject(Chat chatRoom) {
    try {
        MultiUserChatLight multiUserChatLight = XMPPSession.getInstance().getMUCLightManager().getMultiUserChatLight(JidCreate.from(chatRoom.getJid()).asEntityBareJidIfPossible());
        MUCLightRoomConfiguration configuration = multiUserChatLight.getConfiguration();
        chatRoom.setSubject(configuration.getSubject());
    } catch (XmppStringprepException | SmackException.NoResponseException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | InterruptedException e) {
        e.printStackTrace();
    }
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:10,代碼來源:RoomManager.java

示例10: loadMUCLightMembers

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
public List<String> loadMUCLightMembers(String roomJid) throws XmppStringprepException, SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException {
    MultiUserChatLightManager multiUserChatLightManager = MultiUserChatLightManager.getInstanceFor(XMPPSession.getInstance().getXMPPConnection());
    MultiUserChatLight multiUserChatLight = multiUserChatLightManager.getMultiUserChatLight(JidCreate.from(roomJid).asEntityBareJidIfPossible());

    HashMap<Jid, MUCLightAffiliation> occupants = multiUserChatLight.getAffiliations();
    List<String> jids = new ArrayList<>();

    for (Map.Entry<Jid, MUCLightAffiliation> pair : occupants.entrySet()) {
        Jid jid = pair.getKey();
        if (jid != null) {
            jids.add(jid.toString());
        }
    }
    return jids;
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:16,代碼來源:RoomManager.java

示例11: addToMUCLight

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
public void addToMUCLight(User user, String chatJID) {
    MultiUserChatLightManager multiUserChatLightManager = XMPPSession.getInstance().getMUCLightManager();
    try {
        MultiUserChatLight mucLight = multiUserChatLightManager.getMultiUserChatLight(JidCreate.from(chatJID).asEntityBareJidIfPossible());

        Jid jid = JidCreate.from(XMPPUtils.fromUserNameToJID(user.getLogin()));

        HashMap<Jid, MUCLightAffiliation> affiliations = new HashMap<>();
        affiliations.put(jid, MUCLightAffiliation.member);

        mucLight.changeAffiliations(affiliations);
    } catch (XmppStringprepException | InterruptedException | SmackException.NotConnectedException | SmackException.NoResponseException | XMPPException.XMPPErrorException e) {
        e.printStackTrace();
    }
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:16,代碼來源:RoomManager.java

示例12: removeFromMUCLight

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
public void removeFromMUCLight(User user, String chatJID) {
    MultiUserChatLightManager multiUserChatLightManager = XMPPSession.getInstance().getMUCLightManager();
    try {
        MultiUserChatLight mucLight = multiUserChatLightManager.getMultiUserChatLight(JidCreate.from(chatJID).asEntityBareJidIfPossible());

        Jid jid = JidCreate.from(XMPPUtils.fromUserNameToJID(user.getLogin()));

        HashMap<Jid, MUCLightAffiliation> affiliations = new HashMap<>();
        affiliations.put(jid, MUCLightAffiliation.none);

        mucLight.changeAffiliations(affiliations);
    } catch (XmppStringprepException | InterruptedException | SmackException.NotConnectedException | SmackException.NoResponseException | XMPPException.XMPPErrorException e) {
        e.printStackTrace();
    }
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:16,代碼來源:RoomManager.java

示例13: getXOAUTHTokens

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
public void getXOAUTHTokens() {
    TBRManager tbrManager = TBRManager.getInstanceFor(getXMPPConnection());
    try {
        Preferences preferences = Preferences.getInstance();
        TBRTokens tbrTokens = tbrManager.getTokens();

        preferences.setXmppOauthAccessToken(tbrTokens.getAccessToken());
        preferences.setXmppOauthRefreshToken(tbrTokens.getRefreshToken());
    } catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | InterruptedException | SmackException.NotConnectedException e) {
        e.printStackTrace();
    }
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:13,代碼來源:XMPPSession.java

示例14: removeAllContacts

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
public void removeAllContacts()
        throws SmackException.NotLoggedInException, InterruptedException,
        SmackException.NotConnectedException, XMPPException.XMPPErrorException,
        SmackException.NoResponseException {
    Roster roster = Roster.getInstanceFor(XMPPSession.getInstance().getXMPPConnection());
    if (!roster.isLoaded()) {
        roster.reloadAndWait();
    }
    for (RosterEntry entry : roster.getEntries()) {
        roster.removeEntry(entry);
        Presence presence = new Presence(Presence.Type.unsubscribe);
        presence.setTo(entry.getJid());
        XMPPSession.getInstance().sendStanza(presence);
    }
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:16,代碼來源:RosterManager.java

示例15: getPubSubService

import org.jivesoftware.smack.XMPPException; //導入方法依賴的package包/類
public Jid getPubSubService() throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException {
    return PubSubManager.getPubSubService(getXMPPConnection());
}
 
開發者ID:esl,項目名稱:mangosta-android,代碼行數:4,代碼來源:XMPPSession.java


注:本文中的org.jivesoftware.smack.XMPPException.XMPPErrorException方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。