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


Java SmackException.NotLoggedInException方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:24,代码来源:XMPPSession.java

示例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);
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:17,代码来源:RosterManager.java

示例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);
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:17,代码来源:RosterManager.java

示例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();
    }
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:15,代码来源:ChatActivity.java

示例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();
    }
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:13,代码来源:ChatActivity.java

示例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;
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:14,代码来源:ChatActivity.java

示例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();
    }
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:12,代码来源:RoomManager.java

示例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);
    }
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:16,代码来源:RosterManager.java

示例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;
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:29,代码来源:RosterManager.java

示例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;
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:31,代码来源:RosterManager.java

示例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);

}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:8,代码来源:RosterManager.java

示例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);
}
 
开发者ID:esl,项目名称:mangosta-android,代码行数:7,代码来源:RosterManager.java


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