فهرست منبع

vcc: get system info

intirain 4 سال پیش
والد
کامیت
41f83acfc7
6فایلهای تغییر یافته به همراه35 افزوده شده و 4 حذف شده
  1. 1 1
      Makefile
  2. 11 0
      cmd.c
  3. 1 0
      include/vcc/interfaces.h
  4. 4 1
      include/vcc/vcc.h
  5. 2 2
      include/vcc/version.h
  6. 16 0
      vcc.c

+ 1 - 1
Makefile

@@ -1,5 +1,5 @@
 VCC_MAJOR 		= 1
-VCC_MINOR 		= 25
+VCC_MINOR 		= 26
 VCC_PATCH 		= 0
 VCC_STR 		= -rc 
 

+ 11 - 0
cmd.c

@@ -63,6 +63,7 @@ int do_cmd_pins(int, char **);
 int do_cmd_prem(int, char **);
 int do_cmd_ml(int, char **);
 int do_cmd_rl(int, char **);
+int do_cmd_sys(int, char **);
 
 
 int did_warn = 0;
@@ -87,6 +88,7 @@ struct cmdtable cmdtab[] = {
 	{ "-prem", do_cmd_prem, "Remove a plugin. " }, 
 	{ "-ml", do_cmd_ml, "Multi-line. " }, 
 	{ "-rl", do_cmd_rl, "Send a relay message. " }, 
+	{ "-sys", do_cmd_sys, "Get system info. " }, 
 
 	{ NULL, NULL, NULL }
 };
@@ -767,3 +769,12 @@ int do_cmd_rl(int argc, char **argv) {
 
 	return 0;
 }
+
+
+int do_cmd_sys(int argc, char **argv) {
+	(void) argc;
+	(void) argv;
+
+	return get_sys_info();
+}
+

+ 1 - 0
include/vcc/interfaces.h

@@ -57,6 +57,7 @@ int incr_score(char *username, int incr);
 int vcc_create_session(char *name);
 int get_sessions(void);
 int join_session(int sid);
+int get_sys_info(void);
 
 int robot_new_msg(struct vcc_request *);
 

+ 4 - 1
include/vcc/vcc.h

@@ -66,7 +66,10 @@
 
 /* server -> client. new message */
 #define REQ_REL_NEW 	12
-#define REQ_MAX 	13
+
+/* client -> server. get server info (root). */
+#define REQ_SYS_INFO 	13
+#define REQ_MAX 	14
 
 #define REQ_SIZE 	512
 #define USRNAME_SIZE 	32

+ 2 - 2
include/vcc/version.h

@@ -1,2 +1,2 @@
-#define VCC_VERSION "VCC 1.25.0 Sun Jun  5 09:10:37 PM CST 2022 root"
-#define VCC_SEMVER "vcc 1.25.0-rc "
+#define VCC_VERSION "VCC 1.26.0 Wed Jun  8 12:56:51 PM CST 2022 root"
+#define VCC_SEMVER "vcc 1.26.0-rc "

+ 16 - 0
vcc.c

@@ -382,3 +382,19 @@ int is_user_banned(char *usrname) {
 	return 0;
 }
 
+
+int get_sys_info(void) {
+	struct vcc_request req;
+
+	clear_req(&req);
+
+	req.magic = htonl(VCC_MAGIC);
+	req.reqtype = htonl(REQ_SYS_INFO);
+
+	strcpy(req.usrname, usrname);
+	write(fd, &req, REQ_SIZE);
+
+	return 0;
+}
+
+