Package net.sphene.goim.rcp.xmpp.smackextensions

Examples of net.sphene.goim.rcp.xmpp.smackextensions.SearchIQ


  }
 
  private void sendSearch(){
    try {
      SearchIQ iq = new SearchIQ();
      iq.setType(IQ.Type.SET);
//      iq.setType(IQ.Type.GET );
      iq.setFrom(account.xmpp.getConnection().getUser());
      iq.setTo(searchservice);
         
      iq.addField("first");
      iq.setField("first", txtFirstName.getText());
      iq.addField("last");
      iq.setField("last", txtLastName.getText());
      iq.addField("nick");
      iq.setField("nick", txtNickName.getText());
      iq.addField("email");
      iq.setField("email", txtEmail.getText());
     
      new GOIMPacketListener(account.xmpp.getConnection(),
          new PacketIDFilter(iq.getPacketID()), new TaskObserver()) {
        public void processPacket(final Packet packet) {

          final SearchIQ result = (SearchIQ) packet;
          shell.getDisplay().asyncExec(new Runnable() { public void run() {
            shell.setCursor( new Cursor( shell.getDisplay(), SWT.CURSOR_ARROW ));
            if(result==null)
            {
              MessageDialog.openError( shell, "Error" , "No response from server." );
              return;
            }
            if(result.getNumberOfItems()==0){
              MessageDialog.openError( shell, "Error", "No result available for this search criteria"  );
              return;
            }           
          }});
          showResults(result);
View Full Code Here


  }

  private void sendSearchIQ() {
//    SearchIQProvider.install();
    try {
      SearchIQ iq = new SearchIQ();
//      iq.setType(IQ.Type.SET);
      iq.setType(IQ.Type.GET );
      iq.setFrom(account.xmpp.getConnection().getUser());
      iq.setTo(searchservice);
     
      //iq.setTo( "vjud.sphene.net" );
//      iq.setTo( "users.netlab.cz" );
     
      /*iq.addField("first");
      iq.setField("first", txtFirstName.getText());
      iq.addField("last");
      iq.setField("last", txtLastName.getText());
      iq.addField("nick");
      iq.setField("nick", txtNickName.getText());
      iq.addField("email");
      iq.setField("email", txtEmail.getText());
      */
      System.out.println(iq.toXML());

      new GOIMPacketListener(account.xmpp.getConnection(),
          new PacketIDFilter(iq.getPacketID()), new TaskObserver()) {
        public void processPacket(final Packet packet) {

          final SearchIQ result = (SearchIQ) packet;
//          shell.getDisplay().asyncExec(new Runnable() { public void run() {
////            shell.setCursor( new Cursor( shell.getDisplay(), SWT.CURSOR_ARROW ));
//            if(result==null)
//            {
//              MessageDialog.openError( shell, "Error" , "No response from server." );
View Full Code Here

    columnNames.add( field.getLabel() );
    fieldLabel.setToolTipText(field.getDescription());
  }

  protected void click(){
    SearchIQ iq = new SearchIQ();
    iq.setType(IQ.Type.SET);
    iq.setFrom(account.xmpp.getConnection().getUser());
    //iq.setTo(searchservice);
    //iq.setTo( "users.netlab.cz" );

    if (searchIQ != null)
      iq.setTo(searchIQ.getFrom());
   

    Form reply = form.createAnswerForm();
    Iterator i = reply.getFields();
    while (i.hasNext()) {
      FormField field = (FormField) i.next();
      if (field.getType().equals(FormField.TYPE_HIDDEN))
        continue;
      Object obj = (Control) dialogArea.getData(field.getVariable());
      if (obj instanceof Text) {
        reply.setAnswer(field.getVariable(), ((Text) obj)
            .getText());
      } else if (obj instanceof Button) {
        reply.setAnswer(field.getVariable(), ((Button) obj)
            .getSelection());
      }
    }
    replyValue = reply;
    if (searchIQ != null)
      iq.addExtension(reply.getDataFormToSend());

    if (searchIQ == null) {
//      close();
      return;
    }

    //System.out.println("SEND DATA " + iq.getChildElementXML());
    // result = (SearchIQ)account.xmpp.sendIQPacketAndWaitForReply( iq);
    new GOIMPacketListener(account.xmpp.getConnection(),
        new PacketIDFilter(iq.getPacketID()), new TaskObserver()) {
      public void processPacket(final Packet packet) {
        final SearchIQ result = (SearchIQ) packet;
        showResults( result );
      }
    }.registerListener();
    account.xmpp.getConnection().sendPacket(iq);
  }
View Full Code Here

TOP

Related Classes of net.sphene.goim.rcp.xmpp.smackextensions.SearchIQ

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.