]> arthur.barton.de Git - ngircd.git/blobdiff - src/ngircd/conf.c
Allow ngIRCd to detect services connected to an "virtual services server".
[ngircd.git] / src / ngircd / conf.c
index a60a10e7a250586ce6b51e21f8b9ddb8004bba56..97ecb10ff0176edf525a99b05e87eb1661942dcc 100644 (file)
@@ -42,6 +42,7 @@
 #include "client.h"
 #include "defines.h"
 #include "log.h"
+#include "match.h"
 #include "resolve.h"
 #include "tool.h"
 
@@ -292,6 +293,7 @@ Conf_Test( void )
 #endif
                printf( "  MyPassword = %s\n", Conf_Server[i].pwd_in );
                printf( "  PeerPassword = %s\n", Conf_Server[i].pwd_out );
+               printf( "  ServiceMask = %s\n", Conf_Server[i].svs_mask);
                printf( "  Group = %d\n", Conf_Server[i].group );
                printf( "  Passive = %s\n\n", Conf_Server[i].flags & CONF_SFLAG_DISABLED ? "yes" : "no");
        }
@@ -469,6 +471,16 @@ Conf_AddServer( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd
 } /* Conf_AddServer */
 
 
+/**
+ * Check if the given nick name is an service
+ */
+GLOBAL bool
+Conf_IsService(int ConfServer, char *Nick)
+{
+       return MatchCaseInsensitive(Conf_Server[ConfServer].svs_mask, Nick);
+} /* Conf_IsService */
+
+
 static void
 Set_Defaults( bool InitServers )
 {
@@ -1128,6 +1140,13 @@ Handle_SERVER( int Line, char *Var, char *Arg )
                        New_Server.flags |= CONF_SFLAG_DISABLED;
                return;
        }
+       if (strcasecmp(Var, "ServiceMask") == 0) {
+               len = strlcpy(New_Server.svs_mask, ngt_LowerStr(Arg),
+                             sizeof(New_Server.svs_mask));
+               if (len >= sizeof(New_Server.svs_mask))
+                       Config_Error_TooLong(Line, Var);
+               return;
+       }
        
        Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Unknown variable \"%s\"!",
                                                                NGIRCd_ConfFile, Line, Var );