Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.RosterGroup


        groupMessageWindow.getSubjectField().grabFocus();

    }

    private void renameHandler() {
        RosterGroup g = ConnectorThread.getInstance().getRoster()
                .getGroup(group.getGroupName());
        if (g == null) {
            Standard.warningMessage(
                    BuddyList.getInstance().getContainerFrame(), resources
                            .getString("renameGroup"), resources
View Full Code Here


        }

        public void run() {
            if (!BuddyList.getInstance().checkConnection())
                return;
            RosterGroup g = ConnectorThread.getInstance().getRoster()
                    .getGroup(group.getGroupName());
            if (g == null)
                return;

            String error = null;
            try {
                g.setName(newName);
            } catch (Exception ex) {
                error = ex.getMessage();
            }

            final String er = error;
View Full Code Here

        String currentGroup = "";

        Iterator iterator = entry.getGroups();
        while (iterator.hasNext()) {
            RosterGroup group = (RosterGroup) iterator.next();
            currentGroup = group.getName();
        }

        if (!currentGroup.equals("")) {
            this.currentGroup = currentGroup;
        }
View Full Code Here

        rosterGroups[i++] = resources.getString("none");
        rosterGroups[i++] = resources.getString("newGroup");

        Iterator iterator = roster.getGroups();
        while (iterator.hasNext()) {
            RosterGroup rosterGroup = (RosterGroup) iterator.next();
            if ((currentGroup.equals(""))
                     || (!rosterGroup.getName().equals(currentGroup))) {
                rosterGroups[i] = rosterGroup.getName();
                i++;
            }
        }

        return rosterGroups;
View Full Code Here

                    RosterEntry entry = buddy.getRosterEntry();
                    entry.setName(buddyAlias);
                    int c = 0;
                    Iterator groups = entry.getGroups();
                    while (groups.hasNext()) {
                        RosterGroup g = (RosterGroup) groups.next();
                        if(!g.contains(entry)) continue;
                        g.removeEntry(entry);
                        c++;
                    }

                    buddy.setTempGroup(groupName);
                    SwingUtilities.invokeLater(new Runnable()
                    {
                        public void run()
                        {
                            dialog.setVisible(false);
                            buddy.setRemoved(false);

                            NMOptionDialog.createMessageDialog(null, resources.getString("addBuddyDialogTitle"), resources.getString("buddyAdded"));

                            BuddyList.getInstance().getBuddyListTree().addBuddy(
                                    buddy);
                        }
                    });

                    if (groupName != null && !groupName.equals("")) {
                        RosterGroup newGroup = null;
                        newGroup = roster.getGroup(groupName);
                        if (newGroup == null) {
                            com.valhalla.Logger.debug("had to create new group" + groupName);
                            newGroup = roster.createGroup(groupName);
                        } else {
                            com.valhalla.Logger.debug("found group " + newGroup.getName());
                        }

                        if (c != 0) {
                            com.valhalla.Logger.debug("Moving buddy to " + newGroup.getName());
                            newGroup.addEntry(entry);
                        } else {
                            roster.createEntry(buddyId, buddyAlias,
                                    new String[]{groupName});

                        }
View Full Code Here

   * @param groupname
   * @return a String representing the online buddies out of the number of total
   *         buddies for a single group like (3/5)
   */
  protected String buddyCountOnlineForGroup(String groupname) {
      RosterGroup rosterGroup = connection.getRoster().getGroup(groupname);
      int buddyEntries = rosterGroup.getEntryCount();
      int allBuddies = buddyEntries;
      for (Iterator I = rosterGroup.getEntries().iterator(); I.hasNext();) {
        RosterEntry entry = (RosterEntry) I.next();
        Presence presence = connection.getRoster().getPresence(entry.getUser());
        if (presence.getType() == Presence.Type.unavailable) buddyEntries--;
      }
      // final string looks like e.g. "(3/5)"
View Full Code Here

    Section sec = sections.get(account);
    Control[] controls = ((Composite)sec.getClient()).getChildren();
    for(int i = 0 ; i < controls.length ; i++)
      if(controls[i] instanceof Section) controls[i].dispose();
    while(groups.hasNext()) {
      RosterGroup group = (RosterGroup)groups.next();
      Section groupSec = createGroupSection((Composite) sec.getClient(),group.getName());
      Iterator entries = group.getEntries();
      while(entries.hasNext()) {
        RosterEntry entry = (RosterEntry)entries.next();
        createRosterEntry(tk,account,roster, (Composite)groupSec.getClient(),entry,null);
      }
    }
View Full Code Here

                  return null;
                }});
          dialog.setBlockOnOpen(true);
          int code = dialog.open();
          if(code != InputDialog.OK) return;
          RosterGroup group = activeAccount.xmpp.getRoster().createGroup(dialog.getValue());
          try {
            group.addEntry(selectedEntry);
          } catch (XMPPException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
          }
        }
View Full Code Here

        removeFromGroupItem.setEnabled(true);
        addToRoster.setEnabled(false);
      }
      Iterator groups = activeAccount.xmpp.getRoster().getGroups();
      while(groups.hasNext()) {
        RosterGroup group = (RosterGroup)groups.next();
        if(!group.contains(selectedEntry)) {
          MenuItem item = new MenuItem(addToGroup,SWT.PUSH);
          item.setData("group",group);
          item.setText(group.getName());
          item.addListener(SWT.Selection,addToGroupListener);
        }
      }
     
      groups = selectedEntry.getGroups();
      if(!groups.hasNext()) {
        MenuItem item = new MenuItem(removeFromGroup, SWT.PUSH);
        item.setText("Not Listed in any Group");
        item.setEnabled(false);
      }
      while(groups.hasNext()) {
        RosterGroup group = (RosterGroup)groups.next();
        MenuItem item = new MenuItem(removeFromGroup,SWT.PUSH);
        item.setData("group",group);
        item.setText(group.getName());
        item.addListener(SWT.Selection,removeFromGroupListener);
      }
    }
View Full Code Here

      cmbGroup.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
      cmbGroup.add("Default (No Group)");
      cmbGroup.select(0);
      Iterator i = account.xmpp.getRoster().getGroups();
      while(i.hasNext()) {
        RosterGroup group = (RosterGroup)i.next();
        cmbGroup.add(group.getName());
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.jivesoftware.smack.RosterGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.