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


Java RosterGroup.removeEntry方法代码示例

本文整理汇总了Java中org.jivesoftware.smack.RosterGroup.removeEntry方法的典型用法代码示例。如果您正苦于以下问题:Java RosterGroup.removeEntry方法的具体用法?Java RosterGroup.removeEntry怎么用?Java RosterGroup.removeEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.smack.RosterGroup的用法示例。


在下文中一共展示了RosterGroup.removeEntry方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeContactFromGroup

import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
/**
 * Removes a contact item from the group.
 *
 * @param item the ContactItem to remove.
 */
private void removeContactFromGroup(ContactItem item) {
    String groupName = item.getGroupName();
    ContactGroup contactGroup = getContactGroup(groupName);
    Roster roster = SparkManager.getConnection().getRoster();
    RosterEntry entry = roster.getEntry(item.getJID());
    if (entry != null && contactGroup != offlineGroup) {
        try {
            RosterGroup rosterGroup = roster.getGroup(groupName);
            if (rosterGroup != null) {
                RosterEntry rosterEntry = rosterGroup.getEntry(entry.getUser());
                if (rosterEntry != null) {
                    rosterGroup.removeEntry(rosterEntry);
                }
            }
            contactGroup.removeContactItem(contactGroup.getContactItemByJID(item.getJID()));
            checkGroup(contactGroup);
        }
        catch (Exception e) {
            Log.error("Error removing user from contact list.", e);
        }
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:28,代码来源:ContactList.java

示例2: removeUserFromGroup

import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
/**
 * 把一个好友从组中删除
 * @param userJid
 * @param groupName
 */
public static void removeUserFromGroup(final String userJid,final String groupName, final XMPPConnection connection) {
        RosterGroup group = connection.getRoster().getGroup(groupName);
        if (group != null) {
            try {
            	RosterEntry entry = connection.getRoster().getEntry(userJid);
                if (entry != null)
                    group.removeEntry(entry);
            } catch (XMPPException e) {
                e.printStackTrace();
            }
        }
 }
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:18,代码来源:XmppUtil.java

示例3: tryToRemoveUserFromGroup

import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
private void tryToRemoveUserFromGroup(RosterGroup group,
		RosterEntry rosterEntry) throws XXException {
	try {
		group.removeEntry(rosterEntry);
	} catch (XMPPException e) {
		throw new XXException(e.getLocalizedMessage());
	}
}
 
开发者ID:victoryckl,项目名称:XmppTest,代码行数:9,代码来源:SmackImpl.java

示例4: tryToRemoveUserFromGroup

import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
private void tryToRemoveUserFromGroup(RosterGroup group,
		RosterEntry rosterEntry) throws AppException {
	try {
		group.removeEntry(rosterEntry);
	} catch (XMPPException e) {
		throw new AppException(e.getLocalizedMessage());
	}
}
 
开发者ID:misty-rain,项目名称:smartedu,代码行数:9,代码来源:SmackImpl.java

示例5: tryToRemoveUserFromGroup

import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
private void tryToRemoveUserFromGroup(RosterGroup group,
		RosterEntry rosterEntry) throws YaximXMPPException {
	try {
		group.removeEntry(rosterEntry);
	} catch (XMPPException e) {
		throw new YaximXMPPException(e.getLocalizedMessage());
	}
}
 
开发者ID:ufo22940268,项目名称:maven-yaxim,代码行数:9,代码来源:SmackableImp.java

示例6: doRemoveContactFromListAsync

import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
@Override
protected void doRemoveContactFromListAsync(Contact contact, ContactList list) {
    // FIXME synchronize this to executor thread
    if (mConnection == null)
        return;
    Roster roster = mConnection.getRoster();
    String address = contact.getAddress().getAddress();
    try {
        RosterGroup group = roster.getGroup(list.getName());
        if (group == null) {
            debug(TAG, "could not find group " + list.getName() + " in roster");
            return;
        }
        RosterEntry entry = roster.getEntry(address);
        if (entry == null) {
            debug(TAG, "could not find entry " + address + " in group " + list.getName());
            //just ignore it then
        }
        else
        {
            // Remove from Roster if this is the last group
            if (entry.getGroups().size() <= 1)
                roster.removeEntry(entry);
    
            group.removeEntry(entry);
        }
    } catch (XMPPException e) {
        debug(TAG, "remove entry failed: " + e.getMessage());
        throw new RuntimeException(e);
    }
    
    //otherwise, send unsub message and delete from local contact database
    org.jivesoftware.smack.packet.Presence response = new org.jivesoftware.smack.packet.Presence(
            org.jivesoftware.smack.packet.Presence.Type.unsubscribed);
    response.setTo(address);
    sendPacket(response);
    notifyContactListUpdated(list, ContactListListener.LIST_CONTACT_REMOVED, contact);
}
 
开发者ID:prive,项目名称:prive-android,代码行数:39,代码来源:XmppConnection.java

示例7: removeContactFromGroup

import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
@Override
   public void removeContactFromGroup(String groupName, String jid) throws RemoteException {
RosterGroup group = mAdaptee.getGroup(groupName);
try {
    group.removeEntry(mAdaptee.getEntry(jid));
} catch (XMPPException e) {
    e.printStackTrace();
}
   }
 
开发者ID:BoogieMAN2K,项目名称:Beem,代码行数:10,代码来源:RosterAdapter.java

示例8: removeContactItem

import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
public boolean removeContactItem(ContactGroup contactGroup, ContactItem item) {
    if (contactGroup.isSharedGroup()) {
        return false;
    }

    if (contactGroup.isUnfiledGroup()) {
        contactGroup.removeContactItem(item);
        contactGroup.fireContactGroupUpdated();
        return true;
    }

    // Remove entry from Roster Group
    Roster roster = SparkManager.getConnection().getRoster();
    RosterEntry entry = roster.getEntry(item.getJID());

    RosterGroup rosterGroup = null;

    for (RosterGroup group : roster.getGroups()) {
        if (group.getName().equals(contactGroup.getGroupName())) {
            try {
                rosterGroup = group;
                group.removeEntry(entry);
            }
            catch (XMPPException e1) {
                return false;
            }
        }
    }

    if (rosterGroup == null) {
        return false;
    }

    if (!rosterGroup.contains(entry)) {
        contactGroup.removeContactItem(item);
        contactGroup.fireContactGroupUpdated(); //Updating group title
        return true;
    }

    return false;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:42,代码来源:ContactGroupTransferHandler.java


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