diff -u'Nrpk~' src~/accountregdlg.cpp src/accountregdlg.cpp
--- src~/accountregdlg.cpp	2009-06-26 20:56:52 +0400
+++ src/accountregdlg.cpp	2009-06-26 20:57:19 +0400
@@ -21,7 +21,9 @@
 #include <QtCrypto>
 #include <QMessageBox>
 #include <QScrollArea>
+#include <QSettings>
 
+#include "applicationinfo.h"
 #include "accountregdlg.h"
 #include "proxy.h"
 #include "serverlistquerier.h"
@@ -48,11 +50,22 @@ AccountRegDlg::AccountRegDlg(ProxyManage
 	port_ = 5222;
 	
 	// Server select button
-	connect(ui_.le_server,SIGNAL(popup()),SLOT(selectServer()));
+	connect(ui_.le_server,SIGNAL(activated(const QString&)),SLOT(serverSelected(const QString&)));
 	serverlist_querier_ = new ServerListQuerier(this);
 	connect(serverlist_querier_,SIGNAL(listReceived(const QStringList&)),SLOT(serverListReceived(const QStringList&)));
 	connect(serverlist_querier_,SIGNAL(error(const QString&)),SLOT(serverListError(const QString&)));
 
+	// Server list fill button
+	servers_fill_from_menu_mapper = new QSignalMapper(this);
+	QMenu *servers_fill_from_menu = new QMenu(ui_.pb_fill);
+	servers_fill_from_menu->addAction(tr("from Internet"), this, SLOT(selectServer()))->setData(QString(""));
+	loadCustomServers(servers_fill_from_menu);
+	ui_.pb_fill->setMenu(servers_fill_from_menu);
+	connect(servers_fill_from_menu_mapper, SIGNAL(mapped(const QString &)),
+	    this, SIGNAL(customServersSelected(const QString &)));
+	connect(this, SIGNAL(customServersSelected(const QString &)),
+	    this, SLOT(fillCustomServers(const QString &)));
+
 	// Manual Host/Port
 	ui_.le_host->setEnabled(false);
 	ui_.lb_host->setEnabled(false);
@@ -150,13 +163,95 @@ void AccountRegDlg::hostToggled(bool on)
 
 void AccountRegDlg::selectServer()
 {
-	if (ui_.le_server->count() == 0) {
+	if (ui_.le_server->count() == 0 || !serverlist_custom_section_.isEmpty()) {
 		ui_.busy->start();
 		block();
+		serverlist_custom_section_ = "";
 		serverlist_querier_->getList();
 	}
 }
 
+void AccountRegDlg::loadCustomServers(QMenu *menu)
+{
+    CustomServerInfo srvinfo;
+
+#ifdef Q_WS_X11
+    QString confdir = "/etc/psi";
+#else
+    QString confdir = ApplicationInfo::resourcesDir();
+#endif
+
+    QString config = confdir + "/custom_servers_list";
+    if( !QFile::exists(config) )
+	return;
+
+    QSettings custom_servers_conf(config, QSettings::IniFormat);
+    QStringList groups = custom_servers_conf.childGroups();
+    QString last_section;
+    QStringListIterator it(groups);
+    while( it.hasNext() )
+    {
+	QString group = it.next();
+	custom_servers_conf.beginGroup(group);
+	srvinfo.section  = QString::fromUtf8(custom_servers_conf.value("section").toByteArray());
+	srvinfo.name     = QString::fromUtf8(custom_servers_conf.value("name").toByteArray());
+	srvinfo.hostname = QString::fromUtf8(custom_servers_conf.value("hostname").toByteArray());
+	srvinfo.ip       = QString::fromLatin1(custom_servers_conf.value("ip").toByteArray());
+	srvinfo.port     = QString::fromLatin1(custom_servers_conf.value("port").toByteArray());
+	custom_servers_conf.endGroup();
+
+	if( srvinfo.section.isEmpty() || srvinfo.name.isEmpty() || srvinfo.hostname.isEmpty() )
+	    continue;
+
+	serverlist_custom_.append(srvinfo);
+	if( last_section != srvinfo.section )
+	{
+	    last_section = srvinfo.section;
+	    QAction *a = menu->addAction(tr("from %1").arg(srvinfo.section));
+	    connect(a, SIGNAL(triggered()), servers_fill_from_menu_mapper, SLOT(map()));
+	    servers_fill_from_menu_mapper->setMapping(a, srvinfo.section);
+	}
+    }
+}
+
+void AccountRegDlg::fillCustomServers(const QString &section)
+{
+    serverlist_custom_section_ = section;
+    QStringList lst;
+    CustomServerInfo srvinfo;
+    foreach(srvinfo, serverlist_custom_)
+    {
+	if( srvinfo.section == section )
+	    lst.append(srvinfo.name);
+    }
+    serverListReceived(lst);
+}
+
+void AccountRegDlg::serverSelected(const QString &name)
+{
+    if( serverlist_custom_section_.isEmpty() )
+    {
+	ui_.ck_host->setChecked(false);
+	ui_.le_host->setText("");
+	ui_.le_port->setText("5222");
+    }
+    else
+    {
+	CustomServerInfo srvinfo;
+	foreach(srvinfo, serverlist_custom_)
+	{
+	    if( srvinfo.section == serverlist_custom_section_ && srvinfo.name == name )
+	    {
+		ui_.le_server->setEditText(srvinfo.hostname);
+		ui_.ck_host->setChecked(!srvinfo.ip.isEmpty());
+		ui_.le_host->setText(srvinfo.ip);
+		ui_.le_port->setText(srvinfo.port.isEmpty()?"5222":srvinfo.port);
+		break;
+	    }
+	}
+    }
+}
+
 void AccountRegDlg::serverListReceived(const QStringList& list)
 {
 	ui_.busy->stop();
diff -u'Nrpk~' src~/accountregdlg.h src/accountregdlg.h
--- src~/accountregdlg.h	2009-05-23 21:53:19 +0400
+++ src/accountregdlg.h	2009-06-26 20:57:19 +0400
@@ -23,6 +23,8 @@
 
 #include <QDialog>
 #include <QString>
+#include <QMenu>
+#include <QSignalMapper>
 
 #include "profiles.h"
 #include "xmpp_jid.h"
@@ -60,6 +62,9 @@ public:
 	QString tlsOverrideDomain() { return tlsOverrideDomain_; };
 	QByteArray tlsOverrideCert() { return tlsOverrideCert_; };
 
+signals:
+	void customServersSelected(const QString&);
+
 public slots:
 	void done(int);
 
@@ -71,6 +76,8 @@ protected:
 	void block();
 	void unblock();
 
+	void loadCustomServers(QMenu*);
+
 protected slots:
 	void hostToggled(bool);
 	void sslActivated(int);
@@ -79,6 +86,8 @@ protected slots:
 	void selectServer();
 	void serverListReceived(const QStringList&);
 	void serverListError(const QString&);
+	void fillCustomServers(const QString&);
+	void serverSelected(const QString&);
 
 	void client_handshaken();
 	void client_error();
@@ -86,6 +95,7 @@ protected slots:
 	void getFields_finished();
 	void setFields_finished();
 
+
 private:
 	Ui::AccountReg ui_;
 	QScrollArea* fields_container_;
@@ -95,6 +105,17 @@ private:
 	ServerListQuerier *serverlist_querier_;
 	MiniClient *client_;
 	bool isOld_;
+	struct CustomServerInfo
+	{
+	    QString section;
+	    QString name;
+	    QString hostname;
+	    QString ip;
+	    QString port;
+	};
+	QList<CustomServerInfo> serverlist_custom_;
+	QString serverlist_custom_section_;
+	QSignalMapper *servers_fill_from_menu_mapper;
 
 	// Account settings
 	XMPP::Jid jid_, server_;
diff -u'Nrpk~' src~/accountregdlg.h.orig src/accountregdlg.h.orig
--- src~/accountregdlg.h.orig	1970-01-01 03:00:00 +0300
+++ src/accountregdlg.h.orig	2009-05-23 21:53:19 +0400
@@ -0,0 +1,111 @@
+/*
+ * accountregdlg.h
+ * Copyright (C) 2001, 2002, 2006  Justin Karneges, Remko Troncon
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef ACCOUNTREGDLG_H
+#define ACCOUNTREGDLG_H
+
+#include <QDialog>
+#include <QString>
+
+#include "profiles.h"
+#include "xmpp_jid.h"
+#include "ui_accountreg.h"
+
+class ProxyManager;
+class ProxyChooser;
+class QWidget;
+class QScrollArea;
+class QStringList;
+class MiniClient;
+class XDataWidget;
+class ServerListQuerier;
+class QByteArray;
+namespace XMPP {
+	class Form;
+	class XData;
+}
+
+class AccountRegDlg : public QDialog
+{
+	Q_OBJECT
+public:
+	AccountRegDlg(ProxyManager*, QWidget *parent=0);
+	~AccountRegDlg();
+
+	const XMPP::Jid& jid() const { return jid_; }
+	const QString& pass() const { return pass_; }
+	bool useHost() const { return opt_host_; }
+	const QString& host() const { return host_; }
+	int port() const { return port_; }
+	bool legacySSLProbe() { return legacy_ssl_probe_; }
+	UserAccount::SSLFlag ssl() const { return ssl_; }
+	QString proxy() const { return proxy_; }
+	QString tlsOverrideDomain() { return tlsOverrideDomain_; };
+	QByteArray tlsOverrideCert() { return tlsOverrideCert_; };
+
+public slots:
+	void done(int);
+
+protected:
+	static XMPP::XData convertToXData(const XMPP::Form&);
+	static XMPP::Form convertFromXData(const XMPP::XData&);
+
+	bool checkSSL();
+	void block();
+	void unblock();
+
+protected slots:
+	void hostToggled(bool);
+	void sslActivated(int);
+	void next();
+
+	void selectServer();
+	void serverListReceived(const QStringList&);
+	void serverListError(const QString&);
+
+	void client_handshaken();
+	void client_error();
+
+	void getFields_finished();
+	void setFields_finished();
+
+private:
+	Ui::AccountReg ui_;
+	QScrollArea* fields_container_;
+	XDataWidget* fields_;
+	ProxyManager *proxy_manager_;
+	ProxyChooser *proxy_chooser_;
+	ServerListQuerier *serverlist_querier_;
+	MiniClient *client_;
+	bool isOld_;
+
+	// Account settings
+	XMPP::Jid jid_, server_;
+	UserAccount::SSLFlag ssl_;
+	bool opt_host_, legacy_ssl_probe_;
+	QString host_;
+	int port_;
+	QString pass_;
+	QString proxy_;
+	QString tlsOverrideDomain_;
+	QByteArray tlsOverrideCert_;
+};
+
+#endif
diff -u'Nrpk~' src~/accountreg.ui src/accountreg.ui
--- src~/accountreg.ui	2009-05-23 21:53:19 +0400
+++ src/accountreg.ui	2009-06-26 20:57:19 +0400
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>384</width>
-    <height>339</height>
+    <height>400</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -77,6 +77,13 @@
             </property>
            </widget>
           </item>
+          <item row="3" column="0" colspan="2" >
+           <widget class="QPushButton" name="pb_fill" >
+            <property name="text" >
+             <string>Fill servers list</string>
+            </property>
+           </widget>
+          </item>
          </layout>
         </widget>
        </item>
