]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/nntp/serv_nntp.c
amended CAPABILITIES and other stuff meow
[citadel.git] / citadel / modules / nntp / serv_nntp.c
index c99b588d7e45a1d303704c9f88ccdba3e282468f..12bf9c7f7a35fefd909f87b32cf871cc2c86ef0a 100644 (file)
@@ -60,7 +60,7 @@
 #include "locate_host.h"
 #include "citadel_dirs.h"
 #include "ctdl_module.h"
-
+#include "serv_nntp.h"
 
 extern long timezone;
 
@@ -240,6 +240,10 @@ void nntp_noop(void)
 void nntp_capabilities(void)
 {
        cprintf("101 Capability list:\r\n");
+       cprintf("VERSION 2\r\n");
+       cprintf("READER\r\n");
+       cprintf("LIST ACTIVE NEWSGROUPS\r\n");
+       cprintf("IMPLEMENTATION Citadel v%d.%02d\r\n", (REV_LEVEL/100), (REV_LEVEL%100));
 #ifdef HAVE_OPENSSL
        cprintf("STARTTLS\r\n");
 #endif
@@ -335,13 +339,6 @@ void nntp_authinfo(const char *cmd) {
 }
 
 
-// FIXME move this to a header file
-struct nntp_msglist {
-       int num_msgs;
-       long *msgnums;
-};
-
-
 /*
  * Utility function to fetch the current list of message numbers in a room
  */
@@ -394,6 +391,7 @@ void output_roomname_in_list_format(struct ctdlroom *qrbuf, int which_format) {
                high_water_mark = nm.msgnums[nm.num_msgs - 1];
        }
 
+       // Only the mandatory formats are supported
        switch(which_format) {
        case NNTP_LIST_ACTIVE:
                // FIXME we have hardcoded "n" for "no posting allowed" -- fix when we add posting
@@ -403,7 +401,6 @@ void output_roomname_in_list_format(struct ctdlroom *qrbuf, int which_format) {
                cprintf("%s %s\r\n", n_name, qrbuf->QRname);
                break;
        }
-       // FIXME do all the other formats, bitch
 
        if (nm.msgnums != NULL) {
                free(nm.msgnums);
@@ -485,11 +482,6 @@ void nntp_newgroups(const char *cmd) {
 }
 
 
-struct nntp_list_data {
-       int list_format;
-};
-
-
 /*
  * Called once per room by nntp_list() to qualify and possibly output a single room
  */
@@ -499,6 +491,8 @@ void nntp_list_backend(struct ctdlroom *qrbuf, void *data)
        int view;
        struct nntp_list_data *nld = (struct nntp_list_data *)data;
 
+       // FIXME do something with nld->wildmat, bitch
+
        CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
        if (ra & UA_KNOWN) {
                output_roomname_in_list_format(qrbuf, nld->list_format);
@@ -523,6 +517,13 @@ void nntp_list(const char *cmd) {
        extract_token(list_format, cmd, 1, ' ', sizeof list_format);
        extract_token(wildmat, cmd, 2, ' ', sizeof wildmat);
 
+       if (strlen(wildmat) > 0) {
+               nld.wildmat = wildmat;
+       }
+       else {
+               nld.wildmat = NULL;
+       }
+
        if ( (strlen(cmd) < 6) || (!strcasecmp(list_format, "ACTIVE")) ) {
                nld.list_format = NNTP_LIST_ACTIVE;
        }