diff -ur ircd-hybrid-6/include/m_commands.h ircd-hybrid-6-xline/include/m_commands.h
--- ircd-hybrid-6/include/m_commands.h	Fri Apr 12 12:49:32 2002
+++ ircd-hybrid-6-xline/include/m_commands.h	Fri Apr 12 15:28:57 2002
@@ -34,6 +34,7 @@
 extern int m_unkline(struct Client *,struct Client *,int,char **);
 extern int m_dline(struct Client *,struct Client *,int,char **);
 extern int m_undline(struct Client *,struct Client *,int,char **);
+extern int m_xline(struct Client *, struct Client *, int, char **);
 
 extern int m_gline(struct Client *,struct Client *,int,char **);
 extern int m_ungline(struct Client *,struct Client *,int,char **);
diff -ur ircd-hybrid-6/include/msg.h ircd-hybrid-6-xline/include/msg.h
--- ircd-hybrid-6/include/msg.h	Fri Apr 12 12:49:32 2002
+++ ircd-hybrid-6-xline/include/msg.h	Fri Apr 12 15:30:00 2002
@@ -116,6 +116,7 @@
 #define MSG_UNKLINE  "UNKLINE"  /* UNKLINE */
 #define MSG_DLINE    "DLINE"    /* DLINE */
 #define MSG_UNDLINE  "UNDLINE"  /* UNDLINE */
+#define MSG_XLINE    "XLINE"    /* XLINE */
 #define MSG_HTM      "HTM"      /* HTM */
 #define MSG_SET      "SET"      /* SET */
 
@@ -241,6 +242,7 @@
   { MSG_UNKLINE, m_unkline,  0, MAXPARA, 1, 0, 0, 0L },
   { MSG_DLINE,   m_dline,    0, MAXPARA, 1, 0, 0, 0L },
   { MSG_UNDLINE, m_undline,  0, MAXPARA, 1, 0, 0, 0L },
+  { MSG_XLINE,   m_xline,    0, MAXPARA, 1, 0, 0, 0L },
   { MSG_GLINE,   m_gline,    0, MAXPARA, 1, 0, 0, 0L },
   { MSG_UNGLINE, m_ungline,  0, MAXPARA, 1, 0, 0, 0L },
   { MSG_HASH,    m_hash,     0, MAXPARA, 1, 0, 0, 0L },
diff -ur ircd-hybrid-6/include/s_conf.h ircd-hybrid-6-xline/include/s_conf.h
--- ircd-hybrid-6/include/s_conf.h	Fri Apr 12 12:49:32 2002
+++ ircd-hybrid-6-xline/include/s_conf.h	Fri Apr 12 15:30:30 2002
@@ -256,7 +256,8 @@
 typedef enum {
   CONF_TYPE,
   KLINE_TYPE,
-  DLINE_TYPE
+  DLINE_TYPE,
+  XLINE_TYPE
 } KlineType;
 
 extern void write_kline_or_dline_to_conf_and_notice_opers(
diff -ur ircd-hybrid-6/src/m_kline.c ircd-hybrid-6-xline/src/m_kline.c
--- ircd-hybrid-6/src/m_kline.c	Fri Apr 12 12:49:32 2002
+++ ircd-hybrid-6-xline/src/m_kline.c	Fri Apr 12 15:40:05 2002
@@ -76,6 +76,8 @@
 static void WriteDline(const char *, struct Client *,
                        const char *, const char *,
 		       const char *, const char *);
+static void WriteXline(const char *, struct Client *, const char *,
+		       const char *, const char *);
 
 /*
 AddPending()
@@ -1335,3 +1337,139 @@
   nextping = CurrentTime;
   return 0;
 } /* m_dline() */
+
+int m_xline(aClient *cptr, aClient *sptr, int parc, char *parv[])
+{
+    char *host, *reason;
+    aClient *acptr;
+    aConfItem *aconf;
+    char buffer[1024];
+    const char* current_date;
+    const char *dconf;
+
+    if (!MyClient(sptr) || !IsAnOper(sptr))
+    {
+	sendto_one(sptr, form_str(ERR_NOPRIVILEGES), me.name, parv[0]);
+	return 0;
+    }
+
+    if(!IsSetOperK(sptr))
+    {
+	sendto_one(sptr,":%s NOTICE %s :You have no K flag",me.name,parv[0]);
+	return 0;
+    }
+
+    if(parc < 2)
+    {
+	sendto_one(sptr, form_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "XLINE");
+	return 0;
+    }
+
+    host = parv[1];
+
+    if (parc > 2) /* host :reason */
+    {
+	if(strchr(parv[2], ':'))
+	{
+	    sendto_one(sptr, ":%s NOTICE %s :Invalid character ':' in comment",
+		       me.name, parv[0]);
+	    return 0;
+	}
+
+	if(strchr(parv[2], '#'))
+	{
+	    sendto_one(sptr, ":%s NOTICE %s :Invalid character '#' in comment",
+			    me.name, parv[0]);
+	    return 0;
+	}
+
+	if(*parv[2])
+	    reason = parv[2];
+	else
+	    reason = "No Reason";
+    }
+    else
+	reason = "No Reason";
+
+    current_date = smalldate((time_t) 0);
+
+    ircsprintf(buffer, "%s (%s)",reason,current_date);
+
+    aconf = make_conf();
+    aconf->status = CONF_XLINE;
+    aconf->user = NULL;
+    DupString(aconf->host,host);
+    DupString(aconf->name,host);
+    DupString(aconf->passwd,buffer);
+    aconf->port = 2;
+    aconf->next = x_conf;
+    x_conf = aconf;
+    
+    sendto_realops("%s added X-Line for [%s] [%s]", sptr->name, host, reason);
+    log(L_TRACE, "%s added X-Line for [%s] [%s]", sptr->name, host, reason);
+
+    dconf = get_conf_name(XLINE_TYPE);
+
+    if (LockedFile(dconf))
+    {
+	aPendingLine *pptr;
+
+	pptr = AddPending();
+
+	pptr->type = XLINE_TYPE;
+	pptr->sptr = sptr;
+	pptr->rcptr = (aClient *) NULL;
+	pptr->user = (char *) NULL;
+	pptr->host = strdup(host);
+	pptr->reason = strdup(reason);
+	pptr->when = strdup(current_date);
+
+	sendto_one(sptr,
+		   ":%s NOTICE %s :Added X-Line [%s] (config file write delayed)",
+		   me.name, sptr->name, host);
+	return 0;
+    }
+    else if (PendingLines)
+	WritePendingLines(dconf);
+
+    sendto_one(sptr, ":%s NOTICE %s :Added X-Line [%s] to %s",
+	       me.name, sptr->name, host, dconf ? dconf : "configuration file");
+
+    WriteXline(dconf, sptr, host, reason, current_date);
+
+    return 0;
+}
+
+static void WriteXline(const char *filename, aClient *sptr,
+	               const char *host, const char *reason, const char *when)
+{
+    char buffer[1024];
+    int out;
+
+    if (!filename)
+	return;
+
+    if ((out = open(filename, O_RDWR|O_APPEND|O_CREAT, 0644)) == (-1))
+    {
+	sendto_realops("Error opening %s: %s", filename, strerror(errno));
+	return;
+    }
+
+    fchmod(out, 0660);
+
+    ircsprintf(buffer, "#%s!%s@%s X'd: %s:%s (%s)\n",
+	       sptr->name, sptr->username, sptr->host, host, reason, when);
+
+    if (safe_write(sptr, filename, out, buffer) == (-1))
+	return;
+
+    ircsprintf(buffer, "X:%s:%s (%s)::1\n", host, reason, when);
+
+    if (safe_write(sptr, filename, out, buffer) == (-1))
+	return;
+
+    (void)close(out);
+}
+
+
