]> git.stg.codes - stg.git/blobdiff - projects/sgconf/main.cpp
Added messages about starting and stopping modules.
[stg.git] / projects / sgconf / main.cpp
index ec7dadc77b1a7479e143d2b7959702389ec2626f..2c02be27488c8b7c53ac0819847684696616d66d 100644 (file)
@@ -37,9 +37,9 @@
 #include <list>
 #include <sstream>
 
 #include <list>
 #include <sstream>
 
+#include "stg/common.h"
+#include "stg/netunit.h"
 #include "request.h"
 #include "request.h"
-#include "common.h"
-#include "netunit.h"
 #include "common_sg.h"
 #include "sg_error_codes.h"
 
 #include "common_sg.h"
 #include "sg_error_codes.h"
 
@@ -108,7 +108,8 @@ struct option long_options_get[] = {
 {"email",       0, 0, 'L'},  //emaiL
 {"phone",       0, 0, 'P'},  //phone
 {"group",       0, 0, 'G'},  //Group
 {"email",       0, 0, 'L'},  //emaiL
 {"phone",       0, 0, 'P'},  //phone
 {"group",       0, 0, 'G'},  //Group
-{"ip",         0, 0, 'I'},  //IP-address of user
+{"ip",          0, 0, 'I'},  //IP-address of user
+{"authorized-by",0, 0, 800}, //always online
 
 {0, 0, 0, 0}};
 
 
 {0, 0, 0, 0}};
 
@@ -846,6 +847,10 @@ while (1)
             req.ud[c - 700] = " ";
             break;
 
             req.ud[c - 700] = " ";
             break;
 
+        case 800:
+            req.authBy = true;
+            break;
+
         case '?':
         case ':':
             //printf ("Unknown option \n");
         case '?':
         case ':':
             //printf ("Unknown option \n");
@@ -873,7 +878,10 @@ if (missedOptionArg || !CheckParametersGet(&req))
     exit(PARAMETER_PARSING_ERR_CODE);
     }
 
     exit(PARAMETER_PARSING_ERR_CODE);
     }
 
-return ProcessGetUser(req.server, req.port, req.admLogin, req.admPasswd, req.login, &req);
+if (req.authBy)
+    return ProcessAuthBy(req.server, req.port, req.admLogin, req.admPasswd, req.login, &req);
+else
+    return ProcessGetUser(req.server, req.port, req.admLogin, req.admPasswd, req.login, &req);
 }
 //-----------------------------------------------------------------------------
 int mainSet(int argc, char **argv)
 }
 //-----------------------------------------------------------------------------
 int mainSet(int argc, char **argv)
@@ -973,7 +981,7 @@ while (1)
             break;
 
         case 'N': //Note
             break;
 
         case 'N': //Note
-            ParseAnyString(optarg, &str);
+            ParseAnyString(optarg, &str, "koi8-ru");
             req.note = str;
             break;
 
             req.note = str;
             break;
 
@@ -983,12 +991,12 @@ while (1)
             break;
 
         case 'D': //aDdress
             break;
 
         case 'D': //aDdress
-            ParseAnyString(optarg, &str);
+            ParseAnyString(optarg, &str, "koi8-ru");
             req.address = str;
             break;
 
         case 'L': //emaiL
             req.address = str;
             break;
 
         case 'L': //emaiL
-            ParseAnyString(optarg, &str);
+            ParseAnyString(optarg, &str, "koi8-ru");
             req.email = str;
             //printf("EMAIL=%s\n", optarg);
             break;
             req.email = str;
             //printf("EMAIL=%s\n", optarg);
             break;
@@ -999,7 +1007,7 @@ while (1)
             break;
 
         case 'G': //Group
             break;
 
         case 'G': //Group
-            ParseAnyString(optarg, &str);
+            ParseAnyString(optarg, &str, "koi8-ru");
             req.group = str;
             break;
 
             req.group = str;
             break;