Package nu.fw.jeti.jabber

Examples of nu.fw.jeti.jabber.JID


  }
 
//  ---------------------message event---------------------------
  public synchronized void message(Message message)
  {
    JID from = message.getFrom();
    if (message.getType().equals("chat") || (message.getType().equals("error") && message.getThread() != null))
    {
      beep();
      ChatWindow chatWindow;
      JIDStatus jidStatus = backend.getJIDStatus(message.getFrom());
      String server = from.getDomain();
      if(server.indexOf("conference")>-1 ||
        server.indexOf("private")>-1 ||
        server.indexOf("groupchat")>-1)
      {//private messages from groupchat should have a window per resource
        chatWindow = getChatwindow(from,true);
        jidStatus = new UnknownJIDStatus(from,from.getResource());
      }
      else chatWindow = getChatwindow(from,Preferences.getBoolean("jeti","chatwindowPerResource",false));
      if(tabs!=null)
      {
        int index = tabs.indexOfComponent(chatWindow);
        if(index!=-1)
        {
          if(tabs.getSelectedIndex()!=index)
          {
            tabs.setBackgroundAt(index,Color.BLUE);
            tabs.setForegroundAt(index,Color.RED);
          }
          tabs.setToolTipTextAt(index,message.getBody());
        }
      }
      if (chatWindow == null)
      {
        if (jidStatus == nullchatWindow = startChat(new UnknownJIDStatus(from),message.getThread()); // ,"images",true,"unknown",e.getThread());
        else chatWindow = startChat(jidStatus, message.getThread());
//        chatWindow.setExtendedState(JFrame.ICONIFIED); //prevent focus stealing, does not work anymore for some stupid reason 
        //Thread.yield();
        //chatWindow.show();
        //chatWindow.setVisible(true);
        //chatWindow.toBack();
        //setChatWindowPosition(chatWindow);
       
        //chatWindows.add(chatWindow);
      }
      chatWindow.appendMessage(message);
    }
    else if(message.getType().equals("groupchat"))
    {
      //no sound on groupchat server messages
          if(from.getResource()!=null) beep();
    }
    else
    {
      beep();
      new SendMessage(backend, message);
View Full Code Here


  {
    String resource =jid.getResource();
    ChatWindow cw=null;
    for (int tel = 0; tel < chatWindows.size(); tel++)
    {
      JID cwJID = ((ChatWindow)chatWindows.get(tel)).getJIDStatus().getCompleteJID();
      if (cwJID.equals(jid))
      {
        if(resource!=null && resource.equals(cwJID.getResource()))
        {//return if resources are equal, otherwise continue
          return  (ChatWindow) chatWindows.get(tel);
        }
        else if(!matchResources) cw = (ChatWindow) chatWindows.get(tel);
        //if (!chatWindow.isVisible())
View Full Code Here

    JButton btnOK = new JButton(I18N.gettext("OK"));
    btnOK.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        JID jid  = jidInput.createJID();
        if(jid==null)return;
        if(message) new SendMessage(backend,jid,jid.getUser()).setVisible(true);
        else startChat(jid);
        dialog.dispose();
      }
    });
    JButton btnCancel = new JButton();
View Full Code Here

    add(jLabel3, null);
  }

  public JID createJID()
  {
    JID contact = null;
    if (service.equalsToType("jabber") || service.equalsToType("other"))
    {
      try
      {
        contact = JID.checkedJIDFromString(txtContact.getText());
      } catch (InstantiationException e1)
      {
        Popups.errorPopup(e1.getMessage(), I18N.gettext("main.error.Wrong_Jabber_Identifier"));
      }
    } else
    {
      String contactname = txtContact.getText();
      if (service.equalsToType("aim"))
      {
        if (contactname.indexOf(' ') > -1)
        {//remove spaces
          StringBuffer temp = new StringBuffer();
          for (int i = 0; i < contactname.length(); i++)
          {
            char c = contactname.charAt(i);
            if (c != ' ') temp.append(c);
          }
          contactname = temp.toString();
        }
      } else if (service.equalsToType("msn")) contactname = contactname.replace('@', '%');
      if (JID.isValidUser(contactname)) contact = new JID(contactname, service.getServer());
      else Popups.errorPopup(MessageFormat.format(I18N.gettext("main.error.{0}_is_not_valid"), new Object[]{contactname}), I18N.gettext("main.error.Wrong_contact_name"));
    }
    return contact;
  }
View Full Code Here

    else
    {
      if(backend.isPasswordValid(txtOldPassword.getText()))
      {
        //TODO add iq listener that changes password in profile if set
        backend.send(new InfoQuery(new JID(backend.getMyJID().getDomain())
            ,"set",new IQRegister(
            backend.getMyJID().getUser(),txtNewPassword1.getText())));
        this.dispose();
      }
    }
View Full Code Here

        ((PresenceListener) j.next()).presenceChanged(presence);
      }
    }
    else if ("subscribe".equals(type))
    {
      JID from = presence.getFrom();
      if (from.getUser() == null)
      {
        //server
        sendSubscribed(from, "subscribed", presence.getID());
        if (backend.getJIDStatus(presence.getFrom()) == null)
        {
View Full Code Here

    I18N.setMnemonic("main.main.rostermenu.Remove",menuItem);
    menuItem.addActionListener(new java.awt.event.ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        JID to = currentJIDStatus.getJID();
        if (JOptionPane.showConfirmDialog(main,MessageFormat.format(I18N.gettext("main.popup.Really_remove_{0}_from_all_groups_?"),new Object[] { to.toString() }),I18N.gettext("Remove"),JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
        {
          IQXRoster roster = new IQXRoster(new RosterItem(to,null,"remove",null,null));
          backend.send(new InfoQuery("set",roster));
        }
      }
View Full Code Here

    if(name.equals("item"))
    {
      if(items==null)items = new LinkedList();
      try
      {
        JID jid = JID.checkedJIDFromString(attr.getValue("jid"));
        items.add(new DiscoItem(jid,attr.getValue("name"),attr.getValue("node"),attr.getValue("action")));
      } catch (InstantiationException e)
      {
        Log.xmlParseException(e);
      }
View Full Code Here

  private int numberOfServices;
 
  public RegisterServices(Backend backend)
  {
    this.backend = backend;
    server = new JID(backend.getMyJID().getDomain());
    //Collections.sort(services); //object[] not sortable
        try
        {
            jbInit();
        }
View Full Code Here

  }

  void btnChangeServer_actionPerformed(ActionEvent e)
  {
      setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
      JID temp = null;
      try
    {
        temp = JID.checkedJIDFromString(txtServer.getText());
    }
      catch (InstantiationException ex)
View Full Code Here

TOP

Related Classes of nu.fw.jeti.jabber.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.