本文整理汇总了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);
}
}
}
示例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();
}
}
}
示例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());
}
}
示例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());
}
}
示例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());
}
}
示例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);
}
示例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();
}
}
示例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;
}