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


Java Roster.removeEntry方法代码示例

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


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

示例1: perform

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
@Override
public SampleResult perform(JMeterXMPPSampler sampler, SampleResult res) throws Exception {
    Action action = Action.valueOf(sampler.getPropertyAsString(ACTION, Action.get_roster.toString()));
    Roster roster = sampler.getXMPPConnection().getRoster();
    String entry = sampler.getPropertyAsString(ENTRY);
    res.setSamplerData(action.toString() + ": " + entry);
    if (action == Action.get_roster) {
        res.setResponseData(rosterToString(roster).getBytes());
    } else if (action == Action.add_item) {
        roster.createEntry(entry, entry, new String[0]);
    } else if (action == Action.delete_item) {
        RosterEntry rosterEntry = roster.getEntry(entry);
        if (rosterEntry != null) {
            roster.removeEntry(rosterEntry);
        }
    }

    return res;
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:20,代码来源:RosterAction.java

示例2: removeUser

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * 删除好友
 *
 * @param userName
 * @return
 */
public boolean removeUser(String userName) {
    Roster roster = con.getRoster();
    try {
        RosterEntry entry = roster.getEntry(userName);
        if (null != entry) {
            roster.removeEntry(entry);
        }
        return true;
    } catch (XMPPException e) {
        SLog.e(tag, Log.getStackTraceString(e));
    }
    return false;
}
 
开发者ID:jiangzehui,项目名称:xmpp,代码行数:20,代码来源:XmppTool.java

示例3: removeUser

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * 删除一个好友
 * @param roster
 * @param userJid
 * @return
 */
public static boolean removeUser(Roster roster,String userJid)
{
	try {
		RosterEntry entry = roster.getEntry(userJid);
		roster.removeEntry(entry);
		return true;
	} catch (Exception e) {
		e.printStackTrace();
		return false;
	}		
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:18,代码来源:XmppUtil.java

示例4: removeUser

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * ɾ������
 * 
 * @param roster
 * @param userName
 * @return
 */
public boolean removeUser(Roster roster, String userName) {
	try {
		if (userName.contains("@"))
			userName = userName.split("@")[0];
		RosterEntry entry = roster.getEntry(userName);
		if (null != entry)
			roster.removeEntry(entry);
		return true;
	} catch (XMPPException e) {
		SLog.e(tag, Log.getStackTraceString(e));
	}
	return false;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:21,代码来源:XmppConnectionManager.java

示例5: removeUser

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * ɾ��һ������
 * @param roster
 * @param userJid
 * @return
 */
public static boolean removeUser(Roster roster,String userJid)
{
	try {
		RosterEntry entry = roster.getEntry(userJid);
		roster.removeEntry(entry);
		return true;
	} catch (Exception e) {
		e.printStackTrace();
		return false;
	}		
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:18,代码来源:XmppService.java

示例6: doRemoveContactFromListAsync

import org.jivesoftware.smack.Roster; //导入方法依赖的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: handleRemove

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
    * Handles the ?remove URI
    * 
    * @param uri
    *            the decoded uri
    * @throws Exception
    */
   public void handleRemove(URI uri) throws Exception {
// xmpp:[email protected]?remove

String jid = retrieveJID(uri);
Roster roster = SparkManager.getConnection().getRoster();
RosterEntry entry = roster.getEntry(jid);
roster.removeEntry(entry);
   }
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:16,代码来源:UriManager.java

示例8: removeContactFromRoster

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
private void removeContactFromRoster(ContactItem item) {
    Roster roster = SparkManager.getConnection().getRoster();
    RosterEntry entry = roster.getEntry(item.getJID());
    if (entry != null) {
        try {
            roster.removeEntry(entry);
        }
        catch (XMPPException e) {
            Log.warning("Unable to remove roster entry.", e);
        }
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:13,代码来源:ContactList.java

示例9: execute

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
@Override
public XmppResult execute() {
	// TODO Auto-generated method stub
	XmppResult result = createResult();

	Cursor mCursor = null;
	try {
		// 删除关系表
		if (mRosterId != -1) {
			mCursor = mContext.getContentResolver().query(
					ContentUris.withAppendedId(RosterColumns.CONTENT_URI,
							mRosterId),
					new String[] { RosterColumns.USERID,
							RosterColumns.GROUP_ID }, null, null, null);
			if (mCursor != null && mCursor.getCount() == 1) {
				mCursor.moveToFirst();
				mUserId = mCursor.getString(0);
				mGroupId = mCursor.getInt(1);
			}
		}

		Roster roster = XmppConnectionUtils.getInstance().getConnection()
				.getRoster();
		RosterEntry rosterEntry = roster.getEntry(mUserId);
		if (rosterEntry != null) {
			roster.removeEntry(rosterEntry);
		}

		mContext.getContentResolver().delete(
				RosterColumns.CONTENT_URI,
				RosterColumns.USERID + "='"+mUserId+"' and " + RosterColumns.GROUP_ID
						+ "=" + mGroupId,
				null);

		// 删除本地聊天记录
		YiIMUtils.deleteChatRecord(mContext, mUserId);

		// 删除本地会话记录
		YiIMUtils.deleteConversation(mContext, mUserId);

		result.status = Status.SUCCESS;
	} catch (Exception e) {
		YiLog.getInstance().e(e, "delete friend failed.");
		result.obj = e.getMessage();
	} finally {
		if (mCursor != null) {
			mCursor.close();
			mCursor = null;
		}
	}

	return result;
}
 
开发者ID:ikantech,项目名称:yiim_v2,代码行数:54,代码来源:XmppDeleteEntryRunnable.java


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