chiark / gitweb /
remove become from client; more docs updates
[disorder] / clients / disorder.c
index 7d15afea72d8f54076dc191032134f2f664aae99..5b43b099bae5bb1b1cab78068f992ccd2254285f 100644 (file)
@@ -302,11 +302,6 @@ static void cf_set_volume(disorder_client *c,
   if(disorder_set_volume(c, atoi(argv[0]), atoi(argv[1]))) exit(EXIT_FAILURE);
 }
 
-static void cf_become(disorder_client *c,
-                     char **argv) {
-  if(disorder_become(c, argv[0])) exit(EXIT_FAILURE);
-}
-
 static void cf_log(disorder_client *c,
                   char attribute((unused)) **argv) {
   if(disorder_log(c, sink_stdio("stdout", stdout))) exit(EXIT_FAILURE);
@@ -369,6 +364,15 @@ static void cf_tags(disorder_client *c,
       xprintf("%s\n", nullcheck(utf82mb(*vec++)));
 }
 
+static void cf_users(disorder_client *c,
+                    char attribute((unused)) **argv) {
+  char **vec;
+
+  if(disorder_users(c, &vec, 0)) exit(EXIT_FAILURE);
+  while(*vec)
+    xprintf("%s\n", nullcheck(utf82mb(*vec++)));
+}
+
 static void cf_get_global(disorder_client *c, char **argv) {
   char *value;
 
@@ -418,6 +422,26 @@ static void cf_adduser(disorder_client *c,
     exit(EXIT_FAILURE);
 }
 
+static void cf_deluser(disorder_client *c,
+                      char **argv) {
+  if(disorder_deluser(c, argv[0]))
+    exit(EXIT_FAILURE);
+}
+
+static void cf_edituser(disorder_client *c,
+                       char **argv) {
+  if(disorder_edituser(c, argv[0], argv[1], argv[2]))
+    exit(EXIT_FAILURE);
+}
+
+static void cf_userinfo(disorder_client *c, char **argv) {
+  char *s;
+
+  if(disorder_userinfo(c, argv[0], argv[1], &s))
+    exit(EXIT_FAILURE);
+  xprintf("%s\n", nullcheck(utf82mb(s)));
+}
+
 static const struct command {
   const char *name;
   int min, max;
@@ -431,14 +455,16 @@ static const struct command {
                       "List all files and directories in DIR" },
   { "authorize",      1, 1, cf_authorize, 0, "USER",
                       "Authorize USER to connect to the server" },
-  { "become",         1, 1, cf_become, 0, "USER",
-                      "Become user USER" },
+  { "deluser",        1, 1, cf_deluser, 0, "USER",
+                      "Delete a user" },
   { "dirs",           1, 2, cf_dirs, isarg_regexp, "DIR [~REGEXP]",
                       "List directories in DIR" },
   { "disable",        0, 0, cf_disable, 0, "",
                       "Disable play" },
   { "disable-random", 0, 0, cf_random_disable, 0, "",
                       "Disable random play" },
+  { "edituser",       3, 3, cf_edituser, 0, "USER PROPERTY VALUE",
+                      "Set a property of a user" },
   { "enable",         0, 0, cf_enable, 0, "",
                       "Enable play" },
   { "enable-random",  0, 0, cf_random_enable, 0, "",
@@ -512,6 +538,10 @@ static const struct command {
                       "Unset a preference" },
   { "unset-global",   1, 1, cf_unset_global, 0, "NAME",
                       "Unset a global preference" },
+  { "userinfo",       2, 2, cf_userinfo, 0, "USER PROPERTY",
+                      "Get a property of as user" },
+  { "users",          0, 0, cf_users, 0, "",
+                      "List all users" },
   { "version",        0, 0, cf_version, 0, "",
                       "Display the server version" },
 };