Commits

Anonymous committed a06c87b

added user-defined auth scripts

Comments (0)

Files changed (1)

 static char *host;
 
 static int auth_nickserv = 0;
+static char *script = NULL;
 static char *password = NULL;
 static char *autojoin = NULL;
 
 			/* first response from server: try to authenicate
 			 * and join channel */
 			if (auth_nickserv && password != NULL) {
-				irc_send("PRIVMSG NickServ IDENTIFY %s", password);
+				irc_send("PRIVMSG NickServ :IDENTIFY %s", password);
+			}
+			if (script != NULL) {
+				irc_send("%s", script);
 			}
 			if (autojoin != NULL) {
 				irc_send("JOIN %s", autojoin);
 
 static void usage() {
 	printf("Usage:\n"
-			"  six [-p port] [-n nick] [-j channel] [-N] [-k password] host\n\n");
+			"  six [-p port] [-n nick] [-j channel] [-N] [ -s script ] [-k password] host\n\n");
 	exit(EXIT_SUCCESS);
 }
 
 
 	memset(channel, 0, sizeof(channel));
 
-	while ((r = getopt(argc, argv, "hp:n:j:k:N")) != -1) {
+	while ((r = getopt(argc, argv, "hp:n:j:k:Ns:")) != -1) {
 		switch (r) {
 			case 'p':
 				port = optarg;
 			case 'N':
 				auth_nickserv = 1;
 				break;
+			case 's':
+				script = optarg;
+				break;
 			case 'h':
 			default:
 				usage();