本文整理汇总了Java中org.jivesoftware.smack.SmackException.NotLoggedInException方法的典型用法代码示例。如果您正苦于以下问题:Java SmackException.NotLoggedInException方法的具体用法?Java SmackException.NotLoggedInException怎么用?Java SmackException.NotLoggedInException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smack.SmackException
的用法示例。
在下文中一共展示了SmackException.NotLoggedInException方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendResponse
import org.jivesoftware.smack.SmackException; //导入方法依赖的package包/类
/**
* This method is not necessary on this app, is only to show how BoB could be used
*/
private void sendResponse(BoBIQ bobIQ) {
BoBHash bobHash = bobIQ.getBoBHash();
Resources resources = MangostaApplication.getInstance().getResources();
final int resourceId = resources.getIdentifier("sticker_" + Base64.decodeToString(bobHash.getHash()), "drawable",
MangostaApplication.getInstance().getPackageName());
Drawable drawable = resources.getDrawable(resourceId);
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.WEBP, 100, stream);
byte[] bitMapData = stream.toByteArray();
try {
BoBData bobData = new BoBData(0, "image/png", bitMapData);
getBoBManager().responseBoB(bobIQ, bobData);
} catch (InterruptedException | SmackException.NotConnectedException | SmackException.NotLoggedInException e) {
e.printStackTrace();
}
}
示例2: removeContact
import org.jivesoftware.smack.SmackException; //导入方法依赖的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);
}
示例3: addContact
import org.jivesoftware.smack.SmackException; //导入方法依赖的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);
}
示例4: removeChatGuyFromContacts
import org.jivesoftware.smack.SmackException; //导入方法依赖的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();
}
}
示例5: addChatGuyToContacts
import org.jivesoftware.smack.SmackException; //导入方法依赖的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();
}
}
示例6: isChatWithContact
import org.jivesoftware.smack.SmackException; //导入方法依赖的package包/类
private boolean isChatWithContact() {
try {
HashMap<Jid, Presence.Type> buddies = RosterManager.getInstance().getContacts();
for (Map.Entry pair : buddies.entrySet()) {
if (mChat.getJid().equals(pair.getKey().toString())) {
return true;
}
}
} catch (SmackException.NotLoggedInException | InterruptedException | SmackException.NotConnectedException e) {
e.printStackTrace();
}
return false;
}
示例7: loadRosterContactsChats
import org.jivesoftware.smack.SmackException; //导入方法依赖的package包/类
public void loadRosterContactsChats() throws SmackException.NotLoggedInException, InterruptedException, SmackException.NotConnectedException {
try {
HashMap<Jid, Presence.Type> buddies = RosterManager.getInstance().getContacts();
for (Map.Entry pair : buddies.entrySet()) {
String userJid = pair.getKey().toString();
RoomsListManager.getInstance().createChatIfNotExists(userJid, true);
}
} finally {
mListener.onRoomsLoaded();
}
}
示例8: removeAllContacts
import org.jivesoftware.smack.SmackException; //导入方法依赖的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);
}
}
示例9: getContacts
import org.jivesoftware.smack.SmackException; //导入方法依赖的package包/类
public HashMap<Jid, Presence.Type> getContacts()
throws SmackException.NotLoggedInException, InterruptedException,
SmackException.NotConnectedException {
Roster roster = Roster.getInstanceFor(XMPPSession.getInstance().getXMPPConnection());
if (!roster.isLoaded()) {
roster.reloadAndWait();
}
String groupName = "Buddies";
RosterGroup group = roster.getGroup(groupName);
if (group == null) {
roster.createGroup(groupName);
group = roster.getGroup(groupName);
}
HashMap<Jid, Presence.Type> buddies = new HashMap<>();
List<RosterEntry> entries = group.getEntries();
for (RosterEntry entry : entries) {
BareJid jid = entry.getJid();
Presence.Type status = roster.getPresence(jid).getType();
buddies.put(jid, status);
}
return buddies;
}
示例10: getContactsWithSubscriptionPending
import org.jivesoftware.smack.SmackException; //导入方法依赖的package包/类
public HashMap<Jid, Presence.Type> getContactsWithSubscriptionPending()
throws SmackException.NotLoggedInException, InterruptedException,
SmackException.NotConnectedException {
Roster roster = Roster.getInstanceFor(XMPPSession.getInstance().getXMPPConnection());
if (!roster.isLoaded()) {
roster.reloadAndWait();
}
String groupName = "Buddies";
RosterGroup group = roster.getGroup(groupName);
if (group == null) {
roster.createGroup(groupName);
group = roster.getGroup(groupName);
}
HashMap<Jid, Presence.Type> buddiesPending = new HashMap<>();
List<RosterEntry> entries = group.getEntries();
for (RosterEntry entry : entries) {
if (entry.isSubscriptionPending()) {
BareJid jid = entry.getJid();
Presence.Type status = roster.getPresence(jid).getType();
buddiesPending.put(jid, status);
}
}
return buddiesPending;
}
示例11: hasContactSubscriptionPending
import org.jivesoftware.smack.SmackException; //导入方法依赖的package包/类
public boolean hasContactSubscriptionPending(Jid jid)
throws SmackException.NotLoggedInException, InterruptedException,
SmackException.NotConnectedException {
HashMap<Jid, Presence.Type> buddies = getContactsWithSubscriptionPending();
return buddies.containsKey(jid);
}
示例12: isContact
import org.jivesoftware.smack.SmackException; //导入方法依赖的package包/类
public boolean isContact(Jid jid)
throws SmackException.NotLoggedInException, InterruptedException,
SmackException.NotConnectedException {
HashMap<Jid, Presence.Type> buddies = getContacts();
return buddies.containsKey(jid);
}