static { ConfigurationService cfg = LibJitsi.getConfigurationService(); boolean dropUnencryptedPkts = false; if (cfg == null) { String s = System.getProperty(DROP_UNENCRYPTED_PKTS_PNAME); if (s != null) dropUnencryptedPkts = Boolean.parseBoolean(s); } else { dropUnencryptedPkts = cfg.getBoolean(DROP_UNENCRYPTED_PKTS_PNAME, dropUnencryptedPkts); } DROP_UNENCRYPTED_PKTS = dropUnencryptedPkts; }
/** * Returns the set of data that user has entered through this wizard. * * @return Iterator */ @Override public Iterator<Map.Entry<String, String>> getSummary() { Hashtable<String, String> summaryTable = new Hashtable<String, String>(); summaryTable.put( Resources.getString("plugin.jabberaccregwizz.USERNAME"), registration.getUserID()); summaryTable.put( Resources.getString("service.gui.REMEMBER_PASSWORD"), Boolean.toString(registration.isRememberPassword())); summaryTable.put( Resources.getString("plugin.jabberaccregwizz.SERVER"), registration.getServerAddress()); summaryTable.put( Resources.getString("service.gui.PORT"), String.valueOf(registration.getServerPort())); summaryTable.put( Resources.getString("plugin.jabberaccregwizz.ENABLE_KEEP_ALIVE"), String.valueOf(registration.isSendKeepAlive())); summaryTable.put( Resources.getString("plugin.jabberaccregwizz.ENABLE_GMAIL_NOTIFICATIONS"), String.valueOf(registration.isGmailNotificationEnabled())); summaryTable.put( Resources.getString("plugin.jabberaccregwizz.RESOURCE"), registration.getResource()); summaryTable.put( Resources.getString("plugin.jabberaccregwizz.PRIORITY"), String.valueOf(registration.getPriority())); summaryTable.put( Resources.getString("plugin.sipaccregwizz.DTMF_METHOD"), registration.getDTMFMethod()); summaryTable.put( Resources.getString("plugin.sipaccregwizz.DTMF_MINIMAL_TONE_DURATION"), registration.getDtmfMinimalToneDuration()); return summaryTable.entrySet().iterator(); }
/** Constructs the <tt>LoginWindow</tt>. */ private void init() { String title; if (windowTitle != null) title = windowTitle; else title = DesktopUtilActivator.getResources() .getI18NString("service.gui.AUTHENTICATION_WINDOW_TITLE", new String[] {server}); String text; if (windowText != null) text = windowText; else text = DesktopUtilActivator.getResources() .getI18NString("service.gui.AUTHENTICATION_REQUESTED_SERVER", new String[] {server}); String uinText; if (usernameLabelText != null) uinText = usernameLabelText; else uinText = DesktopUtilActivator.getResources().getI18NString("service.gui.IDENTIFIER"); String passText; if (passwordLabelText != null) passText = passwordLabelText; else passText = DesktopUtilActivator.getResources().getI18NString("service.gui.PASSWORD"); setTitle(title); infoTextArea.setEditable(false); infoTextArea.setOpaque(false); infoTextArea.setLineWrap(true); infoTextArea.setWrapStyleWord(true); infoTextArea.setFont(infoTextArea.getFont().deriveFont(Font.BOLD)); infoTextArea.setText(text); infoTextArea.setAlignmentX(0.5f); JLabel uinLabel = new JLabel(uinText); uinLabel.setFont(uinLabel.getFont().deriveFont(Font.BOLD)); JLabel passwdLabel = new JLabel(passText); passwdLabel.setFont(passwdLabel.getFont().deriveFont(Font.BOLD)); TransparentPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1, 8, 8)); labelsPanel.add(uinLabel); labelsPanel.add(passwdLabel); TransparentPanel textFieldsPanel = new TransparentPanel(new GridLayout(0, 1, 8, 8)); textFieldsPanel.add(uinValue); textFieldsPanel.add(passwdField); JPanel southFieldsPanel = new TransparentPanel(new GridLayout(1, 2)); this.rememberPassCheckBox.setOpaque(false); this.rememberPassCheckBox.setBorder(null); southFieldsPanel.add(rememberPassCheckBox); if (signupLink != null && signupLink.length() > 0) southFieldsPanel.add( createWebSignupLabel( DesktopUtilActivator.getResources().getI18NString("plugin.simpleaccregwizz.SIGNUP"), signupLink)); else southFieldsPanel.add(new JLabel()); boolean allowRememberPassword = true; String allowRemPassStr = DesktopUtilActivator.getResources().getSettingsString(PNAME_ALLOW_SAVE_PASSWORD); if (allowRemPassStr != null) { allowRememberPassword = Boolean.parseBoolean(allowRemPassStr); } allowRememberPassword = DesktopUtilActivator.getConfigurationService() .getBoolean(PNAME_ALLOW_SAVE_PASSWORD, allowRememberPassword); setAllowSavePassword(allowRememberPassword); JPanel buttonPanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER)); buttonPanel.add(loginButton); buttonPanel.add(cancelButton); JPanel southEastPanel = new TransparentPanel(new BorderLayout()); southEastPanel.add(buttonPanel, BorderLayout.EAST); TransparentPanel mainPanel = new TransparentPanel(new BorderLayout(10, 10)); mainPanel.setBorder(BorderFactory.createEmptyBorder(20, 0, 20, 20)); JPanel mainFieldsPanel = new TransparentPanel(new BorderLayout(0, 10)); mainFieldsPanel.add(labelsPanel, BorderLayout.WEST); mainFieldsPanel.add(textFieldsPanel, BorderLayout.CENTER); mainFieldsPanel.add(southFieldsPanel, BorderLayout.SOUTH); mainPanel.add(infoTextArea, BorderLayout.NORTH); mainPanel.add(mainFieldsPanel, BorderLayout.CENTER); mainPanel.add(southEastPanel, BorderLayout.SOUTH); this.getContentPane().add(mainPanel, BorderLayout.EAST); this.loginButton.setName("ok"); this.cancelButton.setName("cancel"); if (loginButton.getPreferredSize().width > cancelButton.getPreferredSize().width) cancelButton.setPreferredSize(loginButton.getPreferredSize()); else loginButton.setPreferredSize(cancelButton.getPreferredSize()); this.loginButton.setMnemonic( DesktopUtilActivator.getResources().getI18nMnemonic("service.gui.OK")); this.cancelButton.setMnemonic( DesktopUtilActivator.getResources().getI18nMnemonic("service.gui.CANCEL")); this.loginButton.addActionListener(this); this.cancelButton.addActionListener(this); this.getRootPane().setDefaultButton(loginButton); }
/** * Creates an account for the given user and password. * * @param providerFactory the ProtocolProviderFactory which will create the account * @param userName the user identifier * @param passwd the password * @return the <tt>ProtocolProviderService</tt> for the new account. * @throws OperationFailedException if the operation didn't succeed */ protected ProtocolProviderService installAccount( ProtocolProviderFactory providerFactory, String userName, String passwd) throws OperationFailedException { if (logger.isTraceEnabled()) { logger.trace("Preparing to install account for user " + userName); } Hashtable<String, String> accountProperties = new Hashtable<String, String>(); String protocolIconPath = getProtocolIconPath(); String accountIconPath = getAccountIconPath(); registration.storeProperties( userName, passwd, protocolIconPath, accountIconPath, accountProperties); accountProperties.put( ProtocolProviderFactory.IS_PREFERRED_PROTOCOL, Boolean.toString(isPreferredProtocol())); accountProperties.put(ProtocolProviderFactory.PROTOCOL, getProtocol()); if (isModification()) { providerFactory.modifyAccount(protocolProvider, accountProperties); setModification(false); return protocolProvider; } try { if (logger.isTraceEnabled()) { logger.trace( "Will install account for user " + userName + " with the following properties." + accountProperties); } AccountID accountID = providerFactory.installAccount(userName, accountProperties); ServiceReference serRef = providerFactory.getProviderForAccount(accountID); protocolProvider = (ProtocolProviderService) JabberAccRegWizzActivator.bundleContext.getService(serRef); } catch (IllegalArgumentException exc) { logger.warn(exc.getMessage()); throw new OperationFailedException( "Username, password or server is null.", OperationFailedException.ILLEGAL_ARGUMENT); } catch (IllegalStateException exc) { logger.warn(exc.getMessage()); throw new OperationFailedException( "Account already exists.", OperationFailedException.IDENTIFICATION_CONFLICT); } catch (Throwable exc) { logger.warn(exc.getMessage()); throw new OperationFailedException( "Failed to add account.", OperationFailedException.GENERAL_ERROR); } return protocolProvider; }