Package jabber.roster

Examples of jabber.roster.Jid


    Datas.writerThread.write(res);
    Vector items = new Vector();
    Enumeration contacts = Datas.roster.keys();
    while (contacts.hasMoreElements())
    {
      Jid jid = new Jid((String)contacts.nextElement());
      if (jid.getServername().equalsIgnoreCase(gateway))
        items.addElement(jid.getLittleJid());
    }

    removeRoster(items);
  }
View Full Code Here


            focus.getStyle().setBgColor(0xFF0000);
        }

        public Component getListCellRendererComponent(List list, Object value, int index, boolean isSelected) {

            Jid person = (Jid) value;
            name.setText(person.getNickname());
            status.setText(person.getPresence());
            /*if (person.getPresence().equalsIgnoreCase(Contents.mystring_presence[3])) { //busy

              status.getStyle().setFgColor(0xFF0000);
            }*/
            Image img = Jid.createAvatar(person.getAvatar());
            if (img.getWidth() != 32)
              img = img.scaled(32, 32);
            pic.setIcon(img);
            pic.setPreferredSize(new Dimension(32,32));
            this.setPreferredSize(new Dimension(display_width, 40));
View Full Code Here

          //Dialog.show(title, body, cmds)Contents.failGtw);
          Datas.roster.remove(_roster.getLittleJid());
        }
        else
        {
          Jid rost = (Jid)Datas.roster.get(_roster.getLittleJid());
          if (rost != null)
            rost.setPresence(Presence.getPresence(_presence));
          return;
        }
      }
      else if ((midlet.internal_state == ROSTER) && (_roster.getLittleJid().equals(midlet.currentjid.getLittleJid()))) {
        if (_roster.status_message.equals(""))
          midlet.currentjid.setPresence(Presence.getPresence(_presence));
        else
          midlet.currentjid.setPresence(Presence.getPresence(_presence), _roster.status_message);
        midlet.getGuiRosterItem();
       
      }
      else if (midlet.internal_state == ONLINE)  {
        Jid rost = (Jid)Datas.roster.get(_roster.getLittleJid());
        if (rost != null)
        {
          if (_roster.status_message.equals(""))
            rost.setPresence(Presence.getPresence(_presence));
          else
            rost.setPresence(Presence.getPresence(_presence), _roster.status_message);
        }
        //String title = _roster.getLittleJid();
        //String body = _roster.getUsername() + " is " + Presence.getPresence(_presence);
        midlet.getGuiOnlineMenu();
      }
      else {
        // send an alert
     
        String real_presence = Presence.getPresence(_presence);
        //String title = _roster.getLittleJid();
        //String body = _roster.getUsername() + " is " + real_presence;
        //disattivato alert di cambio presence
        //display.setCurrent(new Alert(title, body, Datas.images.displayImage(real_presence), AlertType.INFO));
        Jid rost = (Jid)Datas.roster.get(_roster.getLittleJid());
        if (rost != null)
        {
          if (_roster.status_message.equals(""))
            rost.setPresence(real_presence);
          else
            rost.setPresence(real_presence, _roster.status_message);
        }
      }
    }
    else if (_presence.equals("unsubscribed")) {
      if (Datas.isGateway(_roster.getServername())) {
        return;//send an alert?
      }
      if (Datas.roster.get(_roster.getLittleJid()) == null)  {
        _roster.setPresence(Presence.getPresence("unsubscribed"));
        Datas.registerRoster(_roster);
      }
      midlet.internal_state = ONLINE;
      Dialog.show(_roster.getLittleJid()+" added!", "Subscription not accepted/pending.", null, Dialog.TYPE_INFO,null, 3000);
      midlet.getGuiOnlineMenu();
     
    }
    else if (_presence.equals("subscribed")) {
      if ((midlet.currentjid = (Jid)Datas.roster.get(_roster.getLittleJid())) == null)  {
        Datas.registerRoster(_roster);
        midlet.currentjid = _roster;
      }
      else {
        midlet.currentjid.setPresence("subscribed");
      }
     
      midlet.internal_state = ROSTER;
      Dialog.show("",_roster.getUsername()+" subscribed!", null, Dialog.TYPE_CONFIRMATION,null, 3000);
     
      //display.setCurrent(new Alert(_roster.getUsername()+" subscribed!", "Changes Saved", null, AlertType.CONFIRMATION), midlet.getGuiRosterItem());
    }
    else if (_presence.equals("subscribe")) {
     
     
      //save the state
      if (midlet.currentjid != null && !midlet.currentjid.getLittleJid().equals(_roster.getLittleJid()))
        infopool.put("currentjid", new Jid(midlet.currentjid.getFullJid(), midlet.currentjid.getPresence()));
      infopool.put("internal_state", new Integer(midlet.internal_state));
      midlet.internal_state = SUBSCRIPTION;
      midlet.currentjid = _roster;
      midlet.getGuiChoose("subscription");
    }
View Full Code Here

TOP

Related Classes of jabber.roster.Jid

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.