本文整理汇总了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);
}
}
示例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());
}
示例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);
}
示例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);
}
示例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();
});
}
示例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();
}
}
示例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();
}
}
示例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));
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
}
示例15: getPubSubService
import org.jivesoftware.smack.XMPPException; //导入方法依赖的package包/类
public Jid getPubSubService() throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException {
return PubSubManager.getPubSubService(getXMPPConnection());
}