Package com.anzsoft.client.XMPP

Examples of com.anzsoft.client.XMPP.XmppQuery


    this.session.addInfoQueryListener(discoListener);
  }
 
  public void getDiscoItems()
  {
    XmppQuery query = session.getFactory().createQuery();
    query.setType(XmppQuery.TYPE_GET);
    query.setID("disco_item_1");
    XmppID jid = XmppID.parseId(session.getUser().getID());
    query.setTo(jid.getDomain());
    query.setQuery("http://jabber.org/protocol/disco#items");
    session.send(query);
  }
View Full Code Here


    session.send(query);
  }
 
  public void getDiscoItemInfo(final String jid)
  {
    XmppQuery query = session.getFactory().createQuery();
    query.setType(XmppQuery.TYPE_GET);
    query.setID("disco_info_"+info_id);
    query.setTo(jid);
    query.setQuery("http://jabber.org/protocol/disco#info");
    session.send(query);
    info_id++;
  }
View Full Code Here

   
  }
 
  public void set(final XmppID jid,final String name,final List<String> groups)
  {
    XmppQuery iq = session.getFactory().createQuery();
    iq.setType(XmppQuery.TYPE_SET);
    iq.setID(id());
    Node query = iq.setQuery("jabber:iq:roster");
    Element item = query.appendChild(iq.getDoc().createElement("item"));
    item.setAttribute("jid", jid.toStringNoResource());
    if(name != null&&!name.isEmpty())
      item.setAttribute("name", name);
    if(groups != null)
    {
      for(String group:groups)
      {
        item.appendChild(DOMHelper.textTag(iq.getDoc(), "group", group));
      }
    }
    send(iq);
  }
View Full Code Here

    send(iq);
  }
 
  public void remove(final XmppID jid)
  {
    XmppQuery iq = session.getFactory().createQuery();
    iq.setType(XmppQuery.TYPE_SET);
    iq.setID(id());
    Element query = iq.setQuery("jabber:iq:roster");
    Element item = query.appendChild(iq.getDoc().createElement("item"));
    item.setAttribute("jid", jid.toStringNoResource());
    item.setAttribute("subscription", "remove");
    send(iq);
  }
View Full Code Here

  public XmppVCard get(final XmppID id,final VCardListener listener)
  {
    if(vcards.containsKey(id.toStringNoResource()))
      return vcards.get(id.toStringNoResource());
   
    XmppQuery iq = JabberApp.instance().getSession().getFactory().createQuery();
    iq.setIQ(id.toStringNoResource(), XmppQuery.TYPE_GET, TextUtils.genUniqueId());
    Element vcardEl = iq.getDoc().createElementNS("vcard-temp", "vCard");
    vcardEl.setAttribute("version", "2.0");
    vcardEl.setAttribute("prodid", "-//HandGen//NONSGML vGen v1.0//EN");
    iq.getNode().appendChild(vcardEl);
    JabberApp.instance().getSession().send(iq, new XmppPacketListener()
    {
      public void onPacketReceived(XmppPacket packet)
      {
        XmppID id = packet.getFromID();
View Full Code Here

    }

    public void sendQuery()
    {
    Debugger.log("SENDING ROSTER QUERY!!");
    XmppQuery query = session.getFactory().createQuery();
    query.setType(XmppQuery.TYPE_GET);
    query.setID("roster_1");
    query.setQuery("jabber:iq:roster");
   
    session.send(query);
    }
View Full Code Here

   
  }
 
  public void get()
  {
    XmppQuery iq = session.getFactory().createQuery();
    iq.setIQ(null, XmppQuery.TYPE_GET, id());
    Element query = iq.setQuery("jabber:iq:private");
    Element prefsElement = iq.getDoc().createElement("ijab");
    prefsElement.setAttribute("xmlns", "ijab:prefs");
    query.appendChild(prefsElement);
    send(iq);   
  }
View Full Code Here

    send(iq);   
  }
 
  public void set()
  {
    XmppQuery iq = session.getFactory().createQuery();
    iq.setIQ(null, XmppQuery.TYPE_SET, id());
    Element query = iq.setQuery("jabber:iq:private");
    Element prefsElement = iq.getDoc().createElement("ijab");
    prefsElement.setAttribute("xmlns", "ijab:prefs");
   
    prefsElement.appendChild(DOMHelper.textTag(iq.getDoc(), "showOnlineOnly", TextUtils.bool2str(iJabPrefs.instance().showOnlineOnly)));
   
    query.appendChild(prefsElement);
    send(iq);
  }
View Full Code Here

    {
      public void selectionChanged(SelectionChangedEvent<Service> se)
      {
        Service service = se.getSelectedItem();
       
        XmppQuery iq = session.getFactory().createQuery();
        iq.setIQ(service.getJid(), XmppQuery.TYPE_GET, TextUtils.genUniqueId());
        iq.setQuery("jabber:iq:search");
        session.send(iq, new XmppPacketListener()
        {
          public void onPacketReceived(XmppPacket iq)
          {
            if(!iq.getType().equals("result"))
              return;
            Element el = (Element) iq.getNode();
            String html;
            if(el.getElementsByTagName("x").getLength()>0&&el.getElementsByTagName("x").getItem(0).getAttribute("xmlns").equals("jabber:x:data"))
            {
              html = JabberXData.genJabberXDataTable(el.getElementsByTagName("x").getItem(0));
            }
View Full Code Here

    //System.out.println(searchstring);
   
    String service = serviceField.getValue().getJid();
    if(searchstring.isEmpty())
    {
      XmppQuery iq = session.getFactory().createQuery();
      iq.setIQ(service+"/users", XmppQuery.TYPE_GET, TextUtils.genUniqueId());
      iq.setQuery("jabber:iq:browse");
      session.send(iq,new XmppPacketListener()
      {
        public void onPacketReceived(XmppPacket packet)
        {
          onSearchResult(packet);
        }
        public void onPacketSent(XmppPacket packet)
        {
         
        }
       
      });
    }
    else
    {
      XmppQuery iq = session.getFactory().createQuery();
      iq.setIQ(service, XmppQuery.TYPE_SET, TextUtils.genUniqueId());
      Element query = iq.setQuery("jabber:iq:search");
      XmlDocument xmlDoc = XmlDocument.create("body", "foo");
      xmlDoc.loadXML("<body>"+searchstring+"</body>");
      query.appendChild(xmlDoc.documentElement().getFirstChildElement().cloneNode(true));
      session.send(iq, new XmppPacketListener()
      {
View Full Code Here

TOP

Related Classes of com.anzsoft.client.XMPP.XmppQuery

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.