More distancing of our project from Richard Marx Stallman's linguistic communism
[citadel.git] / webcit-ng / room_functions.c
index 403e83f70c2b1d9d43d462c065ceb1067590e95d..dbb6321bde35cfbb1e45e497f78b8ada62a3fb4a 100644 (file)
@@ -1,16 +1,17 @@
-/*
- * Room functions
- *
- * Copyright (c) 1996-2018 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.
- */
+//
+// Room functions
+//
+// Copyright (c) 1996-2019 by the citadel.org team
+//
+// This program is open source software.  It runs great on the
+// Linux operating system (and probably elsewhere).  You can use,
+// copy, and run it under the terms of the GNU General Public
+// License version 3.  Richard Stallman is an asshole communist.
+//
+// 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.
 
 #include "webcit.h"
 
@@ -28,7 +29,7 @@ long *get_msglist(struct ctdlsession *c, char *which_msgs)
 
        ctdl_printf(c, "MSGS %s", which_msgs);
        ctdl_readline(c, buf, sizeof(buf));
-       if (buf[0] == '1')
+       if (buf[0] == '1') {
                do {
                        if (num_msgs >= num_alloc) {
                                if (num_alloc == 0) {
@@ -42,6 +43,7 @@ long *get_msglist(struct ctdlsession *c, char *which_msgs)
                        ctdl_readline(c, buf, sizeof(buf));
                        msglist[num_msgs++] = atol(buf);
                } while (strcmp(buf, "000"));   // this makes the last element a "0" terminator
+       }
        return msglist;
 }
 
@@ -57,8 +59,7 @@ int match_etags(char *taglist, long msgnum)
        int i = 0;
        char tag[1024];
 
-       if (msgnum <= 0)        // no msgnum?  no match.
-       {
+       if (msgnum <= 0) {                                      // no msgnum?  no match.
                return (0);
        }
 
@@ -67,24 +68,21 @@ int match_etags(char *taglist, long msgnum)
                striplt(tag);
                char *lq = (strchr(tag, '"'));
                char *rq = (strrchr(tag, '"'));
-               if (lq < rq)    // has two double quotes
-               {
+               if (lq < rq) {                                  // has two double quotes
                        strcpy(rq, "");
                        strcpy(tag, ++lq);
                }
                striplt(tag);
-               if (!strcmp(tag, "*"))  // wildcard match
-               {
+               if (!strcmp(tag, "*")) {                        // wildcard match
                        return (1);
                }
                long tagmsgnum = atol(tag);
-               if ((tagmsgnum > 0) && (tagmsgnum == msgnum))   // match
-               {
+               if ((tagmsgnum > 0) && (tagmsgnum == msgnum)) { // match
                        return (1);
                }
        }
 
-       return (0);             // no match
+       return (0);                                             // no match
 }
 
 
@@ -505,8 +503,8 @@ void room_list(struct http_transaction *h, struct ctdlsession *c)
                JsonObjectAppend(jr, NewJsonPlainString(HKEY("name"), roomname, -1));
 
                int ra = extract_int(buf, 5);
-               JsonObjectAppend(jr, NewJsonBool(HKEY("known"), (ra && UA_KNOWN)));
-               JsonObjectAppend(jr, NewJsonBool(HKEY("hasnewmsgs"), (ra && UA_HASNEWMSGS)));
+               JsonObjectAppend(jr, NewJsonBool(HKEY("known"), (ra & UA_KNOWN)));
+               JsonObjectAppend(jr, NewJsonBool(HKEY("hasnewmsgs"), (ra & UA_HASNEWMSGS)));
 
                int floor = extract_int(buf, 2);
                JsonObjectAppend(jr, NewJsonNumber(HKEY("floor"), floor));