Java Code Examples for org.jivesoftware.smack.Roster#createGroup()

The following examples show how to use org.jivesoftware.smack.Roster#createGroup() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmppTool.java    From xmpp with Apache License 2.0 6 votes vote down vote up
/**
 * 添加到分组
 *
 * @param
 * @param userName
 * @param groupName
 */
public void addUserToGroup(String userName, String groupName) {
    Roster roster = con.getRoster();
    RosterGroup group = roster.getGroup(groupName);
    if (null == group) {
        group = roster.createGroup(groupName);
    }
    RosterEntry entry = roster.getEntry(userName);
    if (entry != null) {
        try {
            group.addEntry(entry);
        } catch (XMPPException e) {
            SLog.e(tag, Log.getStackTraceString(e));
        }
    }

}
 
Example 2
Source File: XmppTool.java    From xmpp with Apache License 2.0 5 votes vote down vote up
/** * ���һ���� */
public static boolean addGroup(Roster roster, String groupName) {
	try {
		roster.createGroup(groupName);
		return true;
	} catch (Exception e) {
		e.printStackTrace();
		return false;
	}
}
 
Example 3
Source File: XmppManager.java    From weixin with Apache License 2.0 5 votes vote down vote up
/**
 * 添加分组
 * 
 * @param roster
 * @param groupName 分组名
 * @return
 */
public boolean addGroup(Roster roster, String groupName) {
	try {
		roster.createGroup(groupName);
		return true;
	} catch (Exception e) {
		e.printStackTrace();
	}
	return false;
}