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


Java PrivacyItem类代码示例

本文整理汇总了Java中org.jivesoftware.smack.packet.PrivacyItem的典型用法代码示例。如果您正苦于以下问题:Java PrivacyItem类的具体用法?Java PrivacyItem怎么用?Java PrivacyItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: parseList

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
public void parseList(XmlPullParser parser, Privacy privacy) throws Exception {
       boolean done = false;
       String listName = parser.getAttributeValue("", "name");
       ArrayList<PrivacyItem> items = new ArrayList<PrivacyItem>();
       while (!done) {
           int eventType = parser.next();
           if (eventType == XmlPullParser.START_TAG) {
               if (parser.getName().equals("item")) {
               	items.add(parseItem(parser));
               }
           }
           else if (eventType == XmlPullParser.END_TAG) {
               if (parser.getName().equals("list")) {
                   done = true;
               }
           }
       }

       privacy.setPrivacyList(listName, items);
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:21,代码来源:PrivacyProvider.java

示例2: parseList

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
public void parseList(XmlPullParser parser, Privacy privacy)
		throws Exception {
	boolean done = false;
	String listName = parser.getAttributeValue("", "name");
	ArrayList<PrivacyItem> items = new ArrayList<PrivacyItem>();
	while (!done) {
		int eventType = parser.next();
		if (eventType == XmlPullParser.START_TAG) {
			if (parser.getName().equals("item")) {
				items.add(parseItem(parser));
			}
		} else if (eventType == XmlPullParser.END_TAG) {
			if (parser.getName().equals("list")) {
				done = true;
			}
		}
	}

	privacy.setPrivacyList(listName, items);
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:21,代码来源:PrivacyProvider.java

示例3: setStatus

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
public void setStatus(byte statusId) {
	if (!connection.isConnected()) {
		return;
	}
	
	//TODO add full visibility list control support
	if (statusId == XMPPEntityAdapter.INVISIBLE_STATUS_ID) {
		Privacy privacy1 = new Privacy();
		
		PrivacyItem item = new PrivacyItem(null, false, 1);
		item.setFilterPresence_out(true);
		
		privacy1.setPrivacyList("invisible", Arrays.asList(new PrivacyItem[]{ item }));
		connection.sendPacket(privacy1);
		
		Privacy privacy2 = new Privacy();
		privacy2.setActiveName("invisible");
		privacy2.setType(Type.SET);
		connection.sendPacket(privacy2);
	}
	
	Presence presence = getService().getEntityAdapter().userStatus2XMPPPresence(statusId);
	connection.sendPacket(presence);
}
 
开发者ID:snuk182,项目名称:aceim,代码行数:25,代码来源:XMPPServiceInternal.java

示例4: createPrivacyList

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
@Override
   public void createPrivacyList(String listName, List<PrivacyListItem> items) throws RemoteException {
Log.d(TAG, "BEGIN createPrivacyList.");
try {
    List<PrivacyItem> privacyItems = new ArrayList<PrivacyItem>();

    PrivacyItem item = new PrivacyItem(PrivacyItem.Type.subscription.name(), true, 2);
    item.setValue(PrivacyRule.SUBSCRIPTION_BOTH);
    privacyItems.add(item);

    mPrivacyListManager.createPrivacyList(listName, privacyItems);
} catch (XMPPException e) {
    Log.e(TAG, e.getMessage());
}
Log.d(TAG, "END createPrivacyList.");
   }
 
开发者ID:BoogieMAN2K,项目名称:Beem,代码行数:17,代码来源:PrivacyListManagerAdapter.java

示例5: addListNode

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
/**
 * Adds a node to a parent on the jtree using the defaultModel
 * 
 * @param node
 *            the node that should be added. this is the childnode
 * @param parent
 *            the parent node, where the node should be added to
 */
private void addListNode(PrivacyTreeNode node, DefaultMutableTreeNode parent) {


    _model.insertNodeInto(node, parent, 0);

    SparkPrivacyList plist = node.getPrivacyList();
  
    PrivacyTreeNode contacts = new PrivacyTreeNode(Res.getString("privacy.node.contacts"));
    contacts.setisContactGroup(true);
    _model.insertNodeInto(contacts, node, 0);
    PrivacyTreeNode groups = new PrivacyTreeNode(Res.getString("privacy.node.groups"));
    groups.setisGroupNode(true);
    _model.insertNodeInto(groups, node, 0);

    for (PrivacyItem pI : plist.getPrivacyItems()) {
        if (pI.getType().equals(PrivacyItem.Type.jid)) {
            _model.insertNodeInto(new PrivacyTreeNode(pI), contacts, 0);
        } else if (pI.getType().equals(PrivacyItem.Type.group)) {
            _model.insertNodeInto(new PrivacyTreeNode(pI), groups, 0);
        }
    }

}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:32,代码来源:PrivacyListTree.java

示例6: createPrivacyList

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
public SparkPrivacyList createPrivacyList(String listName) {
    PrivacyItem item = new PrivacyItem(null,true,999999);
    ArrayList<PrivacyItem> items = new ArrayList<PrivacyItem>();
    items.add(item);
    SparkPrivacyList sparklist = null;
    try {
        privacyManager.createPrivacyList(listName, items);
        privacyManager.getPrivacyList(listName).getItems().remove(item);
        sparklist = new SparkPrivacyList(privacyManager.getPrivacyList(listName));
        _privacyLists.add(sparklist);
        sparklist.addSparkPrivacyListener(_presenceHandler);
    } catch (XMPPException e) {
        Log.warning("Could not create PrivacyList "+listName);
        e.printStackTrace();
    }
    
    return sparklist;
    
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:20,代码来源:PrivacyManager.java

示例7: getPrivacyListItems

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
/**
 * Answer the privacy list items under listName with the allowed and blocked permissions.
 * 
 * @param listName the name of the list to get the allowed and blocked permissions.
 * @return a list of privacy items under the list listName.
 * @throws XMPPException if an error occurs.
 */ 
private List<PrivacyItem> getPrivacyListItems(String listName) throws XMPPException {
    
    // The request of the list is an privacy message with an empty list
    Privacy request = new Privacy();
    request.setPrivacyList(listName, new ArrayList<PrivacyItem>());
    
    // Send the package to the server and get the answer
    Privacy privacyAnswer = getRequest(request);
    
    return privacyAnswer.getPrivacyList(listName);
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:19,代码来源:PrivacyListManager.java

示例8: updatePrivacyList

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
/**
 * The client has edited an existing list. It updates the server content with the resulting 
 * list of privacy items. The {@link PrivacyItem} list MUST contain all elements in the 
 * list (not the "delta").
 * 
 * @param listName the list that has changed its content.
 * @param privacyItems a List with every privacy item in the list.
 * @throws XMPPException if an error occurs.
 */ 
public void updatePrivacyList(String listName, List<PrivacyItem> privacyItems) throws XMPPException {

    // Build the privacy package to add or update the new list
    Privacy request = new Privacy();
    request.setPrivacyList(listName, privacyItems);

    // Send the package to the server
    setRequest(request);
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:19,代码来源:PrivacyListManager.java

示例9: deletePrivacyList

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
/**
 * Remove a privacy list.
 * 
    * @param listName the list that has changed its content.
    * @throws XMPPException if an error occurs.
 */ 
public void deletePrivacyList(String listName) throws XMPPException {
	
	// The request of the list is an privacy message with an empty list
	Privacy request = new Privacy();
	request.setPrivacyList(listName, new ArrayList<PrivacyItem>());

	// Send the package to the server
	setRequest(request);
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:16,代码来源:PrivacyListManager.java

示例10: PrivacyList

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
protected PrivacyList(boolean isActiveList, boolean isDefaultList,
        String listName, List<PrivacyItem> privacyItems) {
    super();
    this.isActiveList = isActiveList;
    this.isDefaultList = isDefaultList;
    this.listName = listName;
    this.items = privacyItems;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:9,代码来源:PrivacyList.java

示例11: getPrivacyListItems

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
/**
 * Answer the privacy list items under listName with the allowed and blocked
 * permissions.
 * 
 * @param listName
 *            the name of the list to get the allowed and blocked
 *            permissions.
 * @return a list of privacy items under the list listName.
 * @throws XMPPException
 *             if an error occurs.
 */
private List<PrivacyItem> getPrivacyListItems(String listName)
		throws XMPPException {

	// The request of the list is an privacy message with an empty list
	Privacy request = new Privacy();
	request.setPrivacyList(listName, new ArrayList<PrivacyItem>());

	// Send the package to the server and get the answer
	Privacy privacyAnswer = getRequest(request);

	return privacyAnswer.getPrivacyList(listName);
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:24,代码来源:PrivacyListManager.java

示例12: deletePrivacyList

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
/**
 * Remove a privacy list.
 * 
 * @param listName
 *            the list that has changed its content.
 * @throws XMPPException
 *             if an error occurs.
 */
public void deletePrivacyList(String listName) throws XMPPException {

	// The request of the list is an privacy message with an empty list
	Privacy request = new Privacy();
	request.setPrivacyList(listName, new ArrayList<PrivacyItem>());

	// Send the package to the server
	setRequest(request);
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:18,代码来源:PrivacyListManager.java

示例13: PrivacyList

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
protected PrivacyList(boolean isActiveList, boolean isDefaultList,
		String listName, List<PrivacyItem> privacyItems) {
	super();
	this.isActiveList = isActiveList;
	this.isDefaultList = isDefaultList;
	this.listName = listName;
	this.items = privacyItems;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:9,代码来源:PrivacyList.java

示例14: getPrivacyListItems

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
/**
 * Answer the privacy list items under listName with the allowed and blocked permissions.
 * 
 * @param listName the name of the list to get the allowed and blocked permissions.
 * @return a list of privacy items under the list listName.
 * @throws org.jivesoftware.smack.XMPPException if an error occurs.
 */ 
private List<PrivacyItem> getPrivacyListItems(String listName) throws XMPPException {
    
    // The request of the list is an privacy message with an empty list
    Privacy request = new Privacy();
    request.setPrivacyList(listName, new ArrayList<PrivacyItem>());
    
    // Send the package to the server and get the answer
    Privacy privacyAnswer = getRequest(request);
    
    return privacyAnswer.getPrivacyList(listName);
}
 
开发者ID:msdx,项目名称:AndroidPNClient,代码行数:19,代码来源:PrivacyListManager.java

示例15: updatePrivacyList

import org.jivesoftware.smack.packet.PrivacyItem; //导入依赖的package包/类
/**
 * The client has edited an existing list. It updates the server content with the resulting 
 * list of privacy items. The {@link org.jivesoftware.smack.packet.PrivacyItem} list MUST contain all elements in the
 * list (not the "delta").
 * 
 * @param listName the list that has changed its content.
 * @param privacyItems a List with every privacy item in the list.
 * @throws org.jivesoftware.smack.XMPPException if an error occurs.
 */ 
public void updatePrivacyList(String listName, List<PrivacyItem> privacyItems) throws XMPPException {

    // Build the privacy package to add or update the new list
    Privacy request = new Privacy();
    request.setPrivacyList(listName, privacyItems);

    // Send the package to the server
    setRequest(request);
}
 
开发者ID:msdx,项目名称:AndroidPNClient,代码行数:19,代码来源:PrivacyListManager.java


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