serv_session.c: style update
authorArt Cancro <ajc@citadel.org>
Sun, 31 Dec 2023 23:12:54 +0000 (18:12 -0500)
committerArt Cancro <ajc@citadel.org>
Sun, 31 Dec 2023 23:12:54 +0000 (18:12 -0500)
citadel/server/modules/ctdlproto/serv_session.c

index 0d4352a54825cc4fdd49e9bf154a65bc0edf94a9..7547331dbba99053fb5c644d2a35a3e32dda09f0 100644 (file)
@@ -1,16 +1,9 @@
-/* 
- * Server functions which perform operations on user objects.
- *
- * Copyright (c) 1987-2023 by the citadel.org team
- *
- * This program is open source software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License, version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
+// Server functions which perform operations on user objects.
+//
+// Copyright (c) 1987-2023 by the citadel.org team
+//
+// This program is open source software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License, version 3.
 
 #include <stdio.h>
 #include <libcitadel.h>
 #include "../../config.h"
 
 
-void cmd_noop(char *argbuf)
-{
+void cmd_noop(char *argbuf) {
        cprintf("%d%cok\n", CIT_OK, CtdlCheckExpress() );
 }
 
 
-void cmd_qnop(char *argbuf)
-{
+void cmd_qnop(char *argbuf) {
        /* do nothing, this command returns no response */
 }
 
 
-/*
- * Set or unset asynchronous protocol mode
- */
-void cmd_asyn(char *argbuf)
-{
+// Set or unset asynchronous protocol mode
+void cmd_asyn(char *argbuf) {
        int new_state;
 
        new_state = extract_int(argbuf, 0);
@@ -46,9 +34,7 @@ void cmd_asyn(char *argbuf)
 }
 
 
-/*
- * cmd_info()  -  Identify this server and its capabilities to the client
- */
+// cmd_info()  -  Identify this server and its capabilities to the client
 void cmd_info(char *cmdbuf) {
        cprintf("%d Server info:\n", LISTING_FOLLOWS);
        cprintf("%d\n", CC->cs_pid);
@@ -61,59 +47,47 @@ void cmd_info(char *cmdbuf) {
        cprintf("%s\n", CtdlGetConfigStr("c_sysadm"));
        cprintf("%d\n", SERVER_TYPE);
        cprintf("%s\n", CtdlGetConfigStr("c_moreprompt"));
-       cprintf("1\n"); /* 1 = yes, this system supports floors */
-       cprintf("1\n"); /* 1 = we support the extended paging options */
-       cprintf("\n");  /* no longer used */
-       cprintf("1\n"); /* 1 = yes, this system supports the QNOP command */
-       cprintf("1\n"); /* 1 = yes, this server is LDAP-enabled */
-
-       if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_NATIVE) && (CtdlGetConfigInt("c_disable_newu") == 0))
-       {
+       cprintf("1\n"); // 1 = yes, this system supports floors
+       cprintf("1\n"); // 1 = we support the extended paging options
+       cprintf("\n");  // no longer used
+       cprintf("1\n"); // 1 = yes, this system supports the QNOP command
+       cprintf("1\n"); // 1 = yes, this server is LDAP-enabled
+
+       if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_NATIVE) && (CtdlGetConfigInt("c_disable_newu") == 0)) {
                cprintf("%d\n", CtdlGetConfigInt("c_disable_newu"));
        }
        else {
-               cprintf("1\n"); /* "create new user" does not work with non-native auth modes */
+               cprintf("1\n"); // "create new user" does not work with non-native auth modes
        }
 
        cprintf("%s\n", CtdlGetConfigStr("c_default_cal_zone"));
 
-       cprintf("0\n"); /* no longer used */
-       cprintf("0\n"); /* no longer used */
-       cprintf("0\n"); /* no longer used */
-       cprintf("0\n"); /* no longer used */
-
+       cprintf("0\n"); // no longer used
+       cprintf("0\n"); // no longer used
+       cprintf("0\n"); // no longer used
+       cprintf("0\n"); // no longer used
        cprintf("%d\n", CtdlGetConfigInt("c_enable_fulltext"));
        cprintf("%s\n", BUILD_ID);
-
        cprintf("0\n"); // no longer used (support for OpenID has ended)
-
        cprintf("%d\n", CtdlGetConfigInt("c_guest_logins"));
        cprintf("000\n");
 }
 
 
-/*
- * echo 
- */
-void cmd_echo(char *etext)
-{
+// echo 
+void cmd_echo(char *etext) {
        cprintf("%d %s\n", CIT_OK, etext);
 }
 
 
-/* 
- * get the paginator prompt
- */
+// get the paginator prompt
 void cmd_more(char *argbuf) {
        cprintf("%d %s\n", CIT_OK, CtdlGetConfigStr("c_moreprompt"));
 }
 
 
-/*
- * the client is identifying itself to the server
- */
-void cmd_iden(char *argbuf)
-{
+// the client is identifying itself to the server
+void cmd_iden(char *argbuf) {
        int dev_code;
        int cli_code;
        int rev_level;
@@ -140,7 +114,7 @@ void cmd_iden(char *argbuf)
        safestrncpy(CC->cs_clientname, desc, sizeof CC->cs_clientname);
        CC->cs_clientname[31] = 0;
 
-       /* For local sockets, allow the client to supply the user's origin address */
+       // For local sockets, allow the client to supply the user's origin address
        if ((CC->is_local_client) || (!IsEmptyStr(CC->cs_addr) && (!strcmp(CC->cs_addr, "127.0.0.1")) || (!strcmp(CC->cs_addr, "::1")))) {
                safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
                CC->cs_host[sizeof CC->cs_host - 1] = 0;
@@ -159,11 +133,8 @@ void cmd_iden(char *argbuf)
 }
 
 
-/*
- * Terminate another running session
- */
-void cmd_term(char *cmdbuf)
-{
+// Terminate another running session
+void cmd_term(char *cmdbuf) {
        int session_num = extract_int(cmdbuf, 0);
        int terminated = CtdlTerminateOtherSession(session_num);
 
@@ -186,15 +157,14 @@ void cmd_term(char *cmdbuf)
 }
 
 
-void cmd_time(char *argbuf)
-{
+void cmd_time(char *argbuf) {
        time_t tv;
        struct tm tmp;
 
        tv = time(NULL);
        localtime_r(&tv, &tmp);
 
-       /* timezone and daylight global variables are not portable. */
+       // timezone and daylight global variables are not portable.
 #ifdef HAVE_STRUCT_TM_TM_GMTOFF
        cprintf("%d %ld|%ld|%d|%ld\n", CIT_OK, (long)tv, tmp.tm_gmtoff, tmp.tm_isdst, server_startup_time);
 #else
@@ -216,6 +186,6 @@ char *ctdl_module_init_serv_session(void) {
                CtdlRegisterProtoHook(cmd_term, "TERM", "terminate another running session");
                CtdlRegisterProtoHook(cmd_time, "TIME", "fetch the date and time from the server");
        }
-        /* return our id for the Log */
+        // return our id for the log
        return "serv_session";
 }