[xchat-gnome] Bug 657389 - [PATCH] Add userserv support for ratbox based server



commit b5aa6326ae1f98fc2c651541c83b70cc56325981
Author: The Lemon Man <segnalazionidalweb gmail com>
Date:   Wed May 16 21:37:17 2012 +0530

    Bug 657389 - [PATCH] Add userserv support for ratbox based server
    
    For ratbox user documentation, refer
    http://docs.ratbox.org/svc_userintro.shtml

 src/common/proto-irc.c |   29 +++++++++++++++++++++--------
 src/common/xchat.h     |    2 +-
 2 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c
index cc13892..1718252 100644
--- a/src/common/proto-irc.c
+++ b/src/common/proto-irc.c
@@ -59,23 +59,33 @@ irc_nickserv (server *serv, char *cmd, char *arg1, char *arg2, char *arg3)
 	switch (serv->nickservtype)
 	{
 	case 0:
-		tcp_sendf (serv, "PRIVMSG NICKSERV :%s %s%s%s\r\n", cmd, arg1, arg2, arg3);
+		tcp_sendf (serv, "PRIVMSG NICKSERV :%s %s %s %s\r\n", cmd, arg1, arg2, arg3);
 		break;
 	case 1:
-		tcp_sendf (serv, "NICKSERV %s %s%s%s\r\n", cmd, arg1, arg2, arg3);
+		tcp_sendf (serv, "NICKSERV %s %s %s %s\r\n", cmd, arg1, arg2, arg3);
 		break;
 	case 2:
-		tcp_sendf (serv, "NS %s %s%s%s\r\n", cmd, arg1, arg2, arg3);
+		tcp_sendf (serv, "NS %s %s %s %s\r\n", cmd, arg1, arg2, arg3);
 		break;
 	case 3:
-		tcp_sendf (serv, "PRIVMSG NS :%s %s%s%s\r\n", cmd, arg1, arg2, arg3);
+		tcp_sendf (serv, "PRIVMSG NS :%s %s %s %s\r\n", cmd, arg1, arg2, arg3);
+		break;
+	case 4:
+		tcp_sendf (serv, "PRIVMSG USERSERV :%s %s %s %s\r\n", cmd, arg1, arg2, arg3);
+		break;
 	}
 }
 
 static void
 irc_ns_identify (server *serv, char *pass)
 {
-	irc_nickserv (serv, "IDENTIFY", pass, "", "");
+	if (serv->nickservtype == 4)
+	{
+		irc_nickserv (serv, "LOGIN", serv->nick, pass, "");
+	} else
+	{
+		irc_nickserv (serv, "IDENTIFY", pass, "", "");
+	}
 }
 
 static void
@@ -355,17 +365,20 @@ process_numeric (session * sess, int n,
 
 	case 4:	/* check the ircd type */
 		serv->use_listargs = FALSE;
-		serv->modes_per_line = 3;		/* default to IRC RFC */
-		if (strncmp (word[5], "bahamut", 7) == 0)				/* DALNet */
+		serv->modes_per_line = 3;			/* default to IRC RFC */
+		if (strncmp (word[5], "bahamut", 7) == 0)	/* DALNet */
 		{
 			serv->use_listargs = TRUE;		/* use the /list args */
-		} else if (strncmp (word[5], "u2.10.", 6) == 0)		/* Undernet */
+		} else if (strncmp (word[5], "u2.10.", 6) == 0)	/* Undernet */
 		{
 			serv->use_listargs = TRUE;		/* use the /list args */
 			serv->modes_per_line = 6;		/* allow 6 modes per line */
 		} else if (strncmp (word[5], "glx2", 4) == 0)
 		{
 			serv->use_listargs = TRUE;		/* use the /list args */
+		} else if (strncmp (word[5], "ircd-ratbox", 11) == 0)
+		{
+			serv->nickservtype = 4;			/* use userserv instead */
 		}
 		goto def;
 
diff --git a/src/common/xchat.h b/src/common/xchat.h
index 08e0dfb..51f8db4 100644
--- a/src/common/xchat.h
+++ b/src/common/xchat.h
@@ -446,7 +446,7 @@ typedef struct server
 	char *last_away_reason;
 	int pos;								/* current position in linebuf */
 	int nickcount;
-	int nickservtype;					/* 0=/MSG nickserv 1=/NICKSERV 2=/NS */
+	int nickservtype;		/* 0=/MSG nickserv 1=/NICKSERV 2=/NS 3=/USERSERV */
 
 	char *chantypes;					/* for 005 numeric - free me */
 	char *chanmodes;					/* for 005 numeric - free me */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]