diff -ur plainpsybnc/lang/english.lng psybnc/lang/english.lng
--- plainpsybnc/lang/english.lng	2009-05-29 23:07:26.000000000 +0200
+++ psybnc/lang/english.lng	2009-05-29 23:57:25.000000000 +0200
@@ -2726,3 +2726,16 @@
 msg1358=USERHOST
 ; p_hash.c line 241
 msg1359=ISON
+
+; SETCONNECTDELAY command
+; -----------------------------------------------------
+msg1460=SETCONNECTDELAY
+msg1461=Changes the connection delay (in seconds) of IRC-clients
+msg1462=help/SETCONNECTDELAY.TXT
+msg1463=:-psyBNC!psyBNC@lam3rz.de PRIVMSG %s :No delay given. Use SETCONNECTDELAY delay.
+msg1464=:-psyBNC!psyBNC@lam3rz.de PRIVMSG %s :Connection delay changed from %d seconds to to %d seconds.
+msg1465=:-psyBNC!psyBNC@lam3rz.de PRIVMSG %s :Invalid connection delay. It must be an integer between 0 and 600.
+msg1466=Connection delay changed from %d seconds to %d seconds by %s.
+msg1467=Connection delay changed from invalid value to %d seconds by %s.
+msg1468=CONNECTDELAY
+msg1469=CONNECTDELAY is currently set to zero. No clients will try to connect!
diff -ur plainpsybnc/src/p_client.c psybnc/src/p_client.c
--- plainpsybnc/src/p_client.c	2009-05-29 23:07:26.000000000 +0200
+++ psybnc/src/p_client.c	2009-05-30 00:58:24.000000000 +0200
@@ -2248,6 +2248,54 @@
     return 0x0;
 }
 
+/* setconnectdelay - set the connection delay of users */
+
+int cmdsetconnectdelay(int usern)
+{
+    char *pt;
+    int rc;
+	int olddelay;
+	char olddelay2[5] = "";
+    pcontext;
+    if(*irccontent==0)
+    {
+	ssnprintf(user(usern)->insock,lngtxt(1463),user(usern)->nick);
+	return -1;
+    }
+    rc=getini(lngtxt(267),"CONNECTDELAY",INIFILE);
+    if(rc==0) {
+		if (strcmp(value, "0") != 0 && atoi(value) <= 0 || atoi(irccontent)>600) {
+			olddelay = 30;
+			if (strcmp(irccontent, "0") != 0 && atoi(irccontent) <= 0 || atoi(irccontent)>600) {
+				p_log(LOG_INFO,usern,lngtxt(1467),olddelay,"System");
+				snprintf(olddelay2, sizeof(olddelay2), "%d", olddelay);
+				writeini(lngtxt(267),lngtxt(1468),INIFILE,olddelay2);
+				flushconfig();
+			}
+		} else {
+			olddelay = atoi(value);
+		}
+	} else {
+		olddelay = 30;
+		if (strcmp(irccontent, "0") != 0 && atoi(irccontent) <= 0 || atoi(irccontent)>600) {
+			p_log(LOG_INFO,usern,lngtxt(1467),olddelay,"System");
+			snprintf(olddelay2, sizeof(olddelay2), "%d", olddelay);
+			writeini(lngtxt(267),lngtxt(1468),INIFILE,olddelay2);
+			flushconfig();
+		}
+	}
+	if (strcmp(irccontent, "0") != 0 && atoi(irccontent) <= 0 || atoi(irccontent)>600) {
+		ssnprintf(user(usern)->insock,lngtxt(1465),user(usern)->nick);
+		return -1;
+	}
+	writeini(lngtxt(267),lngtxt(1468),INIFILE,irccontent);
+	flushconfig();
+	ssnprintf(user(usern)->insock,lngtxt(1464),user(usern)->nick,olddelay,atoi(irccontent));
+	p_log(LOG_INFO,usern,lngtxt(1466),olddelay,atoi(irccontent),user(usern)->login);
+    return -1;
+}
+
+
 #ifdef LINKAGE
 
 int cmdname(int usern)
diff -ur plainpsybnc/src/p_global.h psybnc/src/p_global.h
--- plainpsybnc/src/p_global.h	2009-05-29 23:07:26.000000000 +0200
+++ psybnc/src/p_global.h	2009-05-30 00:07:57.000000000 +0200
@@ -815,6 +815,7 @@
 int cmdrehash(int usern); 
 int cmdadmin(int usern); 
 int cmdunadmin(int usern); 
+int cmdsetconnectdelay(int usern);
 int cmdbkill(int usern); 
 int cmdbquit(int usern); 
 int cmdbconnect(int usern);
diff -ur plainpsybnc/src/p_hash.c psybnc/src/p_hash.c
--- plainpsybnc/src/p_hash.c	2009-05-29 23:07:26.000000000 +0200
+++ psybnc/src/p_hash.c	2009-05-30 00:08:37.000000000 +0200
@@ -170,7 +170,8 @@
 #endif
     {1342,	cmdsetlang,	1343,	1344	,0,1},
     {1252,	printhelp,	1253,	1254	,0,0},
-    {0,		NULL,		0,	0	,0,0}
+    {1460,	cmdsetconnectdelay,	1461,	1462	,0,1},
+	{0,		NULL,		0,	0	,0,0}
 };
 
 struct hasht outboundhash[]={
diff -ur plainpsybnc/src/p_server.c psybnc/src/p_server.c
--- plainpsybnc/src/p_server.c	2009-05-29 23:07:26.000000000 +0200
+++ psybnc/src/p_server.c	2009-05-30 00:53:57.000000000 +0200
@@ -1365,7 +1365,10 @@
    int issl=SSL_OFF;
    char vsl[10];
    char *ep;
+   int rc;
+   int connectdelay=30;
    static unsigned long lastconnect=0;
+   static unsigned long lastconnectwarn=0;
    unsigned long thistime=time(NULL);
    struct socketnodes *lkm;
 #ifdef OIDENTD
@@ -1373,7 +1376,19 @@
    FILE *oid;
 #endif
    int nlink=0; 
-   if((thistime-lastconnect)<5) return 0x0;
+	rc = getini(lngtxt(994),lngtxt(1468),INIFILE);
+	if (rc == 0) {
+		if (strcmp(value, "0") == 0 || (atoi(value) > 0 && atoi(value)<=600))
+			connectdelay = atoi(value);
+	}
+   if(connectdelay==0) {
+	   if ((thistime-lastconnectwarn)>600) { /* Put a warning entry in the log each 600th second, if we are not connecting clients */
+		   lastconnectwarn=thistime;
+		   p_log(LOG_INFO,-1,lngtxt(1469));
+	   }
+	   return 0x0;
+   }
+   if((thistime-lastconnect)<connectdelay) return 0x0;
    vsl[0]=0;   
    if (user(nuser)->outstate == STD_NOCON)
    {
diff -ur plainpsybnc/src/psybnc.c psybnc/src/psybnc.c
--- plainpsybnc/src/psybnc.c	2009-05-29 23:07:26.000000000 +0200
+++ psybnc/src/psybnc.c	2009-05-30 00:50:18.000000000 +0200
@@ -104,9 +104,9 @@
 {
     slice++;
     delayinc=1;
-    if(slice==1)
-	checkclients();
-    else 
+//    if(slice==1)
+//	checkclients();
+//    else 
     if(slice==2)
         checklinks();
     else 
@@ -129,7 +129,8 @@
    delayinc=1;
    while(1)
    {
-       em+=socketdriver();
+	 checkclients();
+     em+=socketdriver();
        if(em>=5)
        {
 	   em=0;

