X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fmodules%2Fnntp%2Fserv_nntp.c;h=9147691a8147e8bf21f8643e77f2d595b49a0ac9;hp=2aa885dd3c6e712fcc2fb11ab3d0607b7ddf7c39;hb=29bc46c83ca6f185a29de4ac3bf7db67c04abd7c;hpb=7486ac08b69a9f62f0e2b8c73b27a7d5a70e98b3 diff --git a/citadel/modules/nntp/serv_nntp.c b/citadel/modules/nntp/serv_nntp.c index 2aa885dd3..9147691a8 100644 --- a/citadel/modules/nntp/serv_nntp.c +++ b/citadel/modules/nntp/serv_nntp.c @@ -336,6 +336,42 @@ void nntp_authinfo(const char *cmd) { + + +/* + */ +void nntp_newgroups_backend(struct ctdlroom *qrbuf, void *data) +{ + int ra; + int view; + + CtdlRoomAccess(qrbuf, &CC->user, &ra, &view); + + if (ra & UA_KNOWN) { + char n_name[1024]; + room_to_newsgroup(n_name, qrbuf->QRname, sizeof n_name); + cprintf("%s\r\n", n_name); + } +} + +/* + * Implements the NEWGROUPS command (FIXME not finished) + */ +void nntp_newgroups(const char *cmd) { + /* + * HACK: this works because the 5XX series error codes from citadeli + * protocol will also be considered error codes by an NNTP client + */ + if (CtdlAccessCheck(ac_logged_in_or_guest)) return; + + cprintf("231 imma show you everything FIXME\r\n"); + CtdlGetUser(&CC->user, CC->curr_user); + cprintf("%d Rooms w/o new msgs:\n", LISTING_FOLLOWS); + CtdlForEachRoom(nntp_newgroups_backend, NULL); + cprintf(".\r\n"); +} + + /* * Main command loop for NNTP server sessions. */ @@ -378,6 +414,10 @@ void nntp_command_loop(void) nntp_authinfo(ChrPtr(Cmd)); } + else if (!strcasecmp(cmdname, "newgroups")) { + nntp_newgroups(ChrPtr(Cmd)); + } + else { cprintf("500 I'm afraid I can't do that.\r\n"); } @@ -387,7 +427,7 @@ void nntp_command_loop(void) /*****************************************************************************/ -/* MODULE INITIALIZATION STUFF */ +/* MODULE INITIALIZATION STUFF */ /*****************************************************************************/