]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conf.c
Convert CONN_ID and Conf_MaxConnections to "int" datatype
[ngircd-alex.git] / src / ngircd / conf.c
index 923cdc025bf50be6bad356ff56e802b3e1a8dc14..034281c06a86ac7c42bc3edb6adffcaa3fb0d0ae 100644 (file)
@@ -346,7 +346,7 @@ Conf_Test( void )
 
        puts("[LIMITS]");
        printf("  ConnectRetry = %d\n", Conf_ConnectRetry);
-       printf("  MaxConnections = %ld\n", Conf_MaxConnections);
+       printf("  MaxConnections = %d\n", Conf_MaxConnections);
        printf("  MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP);
        printf("  MaxJoins = %d\n", Conf_MaxJoins > 0 ? Conf_MaxJoins : -1);
        printf("  MaxNickLength = %u\n", Conf_MaxNickLength - 1);
@@ -636,14 +636,41 @@ Conf_AddServer(const char *Name, UINT16 Port, const char *Host,
 }
 
 /**
- * Check if the given nick name is an service.
+ * Check if the given nick name is reserved for services on a particular server.
  *
+ * @param ConfServer The server index to check.
+ * @param Nick The nick name to check.
  * @returns true if the given nick name belongs to an "IRC service".
  */
 GLOBAL bool
-Conf_IsService(int ConfServer, const char *Nick)
+Conf_NickIsService(int ConfServer, const char *Nick)
 {
-       return MatchCaseInsensitive(Conf_Server[ConfServer].svs_mask, Nick);
+       assert (ConfServer >= 0);
+       assert (ConfServer < MAX_SERVERS);
+
+       return MatchCaseInsensitiveList(Conf_Server[ConfServer].svs_mask,
+                                       Nick, ",");
+}
+
+/**
+ * Check if the given nick name is blocked for "normal client" use.
+ *
+ * @param ConfServer The server index or NONE to check all configured servers.
+ * @param Nick The nick name to check.
+ * @returns true if the given nick name belongs to an "IRC service".
+ */
+GLOBAL bool
+Conf_NickIsBlocked(const char *Nick)
+{
+       int i;
+
+       for(i = 0; i < MAX_SERVERS; i++) {
+               if (!Conf_Server[i].name[0])
+                       continue;
+               if (Conf_NickIsService(i, Nick))
+                       return true;
+       }
+       return false;
 }
 
 /**
@@ -1405,7 +1432,7 @@ Handle_LIMITS(int Line, char *Var, char *Arg)
                return;
        }
        if (strcasecmp(Var, "MaxConnections") == 0) {
-               Conf_MaxConnections = atol(Arg);
+               Conf_MaxConnections = atoi(Arg);
                if (!Conf_MaxConnections && strcmp(Arg, "0"))
                        Config_Error_NaN(Line, Var);
                return;