From 3cb9d2a1e4610aef23b744cd8c3e1129869fca9f Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Tue, 13 Apr 2004 08:05:06 +0000 Subject: [PATCH] Updates for newsgroup names --- lib/dbftn.c | 14 ++++++++++++++ lib/mbsedb.h | 1 + mbfido/Makefile | 2 +- mbfido/createm.c | 4 +++- mbnntp/commands.c | 14 ++++++++++++++ mbsetup/Makefile | 2 +- mbsetup/m_marea.c | 5 ++++- 7 files changed, 38 insertions(+), 4 deletions(-) diff --git a/lib/dbftn.c b/lib/dbftn.c index 8f709995..c339ccb0 100644 --- a/lib/dbftn.c +++ b/lib/dbftn.c @@ -97,3 +97,17 @@ int SearchFidonet(unsigned short zone) +char *GetFidoDomain(unsigned short zone) +{ + static char domain[9]; + + memset(&domain, 0, sizeof(domain)); + + if (SearchFidonet(zone) == FALSE) + return NULL; + + strncpy(domain, fidonet.domain, 8); + return domain; +} + + diff --git a/lib/mbsedb.h b/lib/mbsedb.h index 61d84584..d19cb5d3 100644 --- a/lib/mbsedb.h +++ b/lib/mbsedb.h @@ -59,6 +59,7 @@ char fidonet_fil[81];/* Fidonet database filename */ int InitFidonet(void); /* Initialize fidonet database */ int TestFidonet(unsigned short); /* Test if zone is in memory */ int SearchFidonet(unsigned short); /* Search specified zone and load */ +char *GetFidoDomain(unsigned short); /* Search Fidonet domain name */ diff --git a/mbfido/Makefile b/mbfido/Makefile index e45dca7a..f31ae9f9 100644 --- a/mbfido/Makefile +++ b/mbfido/Makefile @@ -194,7 +194,7 @@ mbftoberep.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfuti mbfmove.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfmove.h mbfdel.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfmove.h bounce.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/msg.h ../lib/msgtext.h ../lib/mbsedb.h sendmail.h postnetmail.h ping.h -createm.o: ../config.h ../lib/mbselib.h ../lib/msg.h mgrutil.h createm.h +createm.o: ../config.h ../lib/mbselib.h ../lib/msg.h ../lib/users.h ../lib/mbsedb.h mgrutil.h createm.h createf.o: ../config.h ../lib/mbselib.h mgrutil.h createf.h msgflags.o: ../config.h ../lib/mbselib.h msgflags.h dirsession.o: ../config.h ../lib/mbselib.h dirsession.h diff --git a/mbfido/createm.c b/mbfido/createm.c index 8c012798..125cdec9 100644 --- a/mbfido/createm.c +++ b/mbfido/createm.c @@ -31,6 +31,8 @@ #include "../config.h" #include "../lib/mbselib.h" #include "../lib/msg.h" +#include "../lib/users.h" +#include "../lib/mbsedb.h" #include "mgrutil.h" #include "createm.h" @@ -250,7 +252,7 @@ int CheckEchoGroup(char *Area, int SendUplink, faddr *f) if (tag[i] == '.') tag[i] = '/'; sprintf(msgs.Base, "%s/%s", mgroup.BasePath, tag); - sprintf(msgs.Newsgroup, "%s.%s", msgs.Group, tag); + sprintf(msgs.Newsgroup, "%s.%s", GetFidoDomain(msgs.Aka.zone), tag); for (i = 0; i < strlen(msgs.Newsgroup); i++) { msgs.Newsgroup[i] = tolower(msgs.Newsgroup[i]); if (msgs.Newsgroup[i] == '/') diff --git a/mbnntp/commands.c b/mbnntp/commands.c index cc500a50..f6ebc6ff 100644 --- a/mbnntp/commands.c +++ b/mbnntp/commands.c @@ -35,8 +35,22 @@ void command_list(char *cmd) { + FILE *fp; + char *temp; + send_nntp("215 List of newsgroups follows"); + temp = calloc(PATH_MAX, sizeof(char)); + sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT")); + if ((fp = fopen(temp, "r"))) { + fread(&msgshdr, sizeof(msgshdr), 1, fp); + while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) { + fseek(fp, msgs.syssize, SEEK_CUR); + } + } else { + WriteError("$Can't open %s", temp); + } + free(temp); send_nntp("."); } diff --git a/mbsetup/Makefile b/mbsetup/Makefile index ff734c6c..e2d93e53 100644 --- a/mbsetup/Makefile +++ b/mbsetup/Makefile @@ -75,7 +75,7 @@ grlist.o: ../config.h ../lib/mbselib.h screen.h grlist.h ledit.h m_domain.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h m_global.h m_menu.h m_domain.h m_fgroup.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_global.h m_node.h m_archive.h m_ngroup.h m_ticarea.h m_fgroup.h m_lang.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_global.h m_lang.h -m_marea.o: ../config.h ../lib/mbselib.h ../lib/msg.h screen.h mutil.h ledit.h grlist.h m_global.h m_node.h m_mgroup.h m_marea.h +m_marea.o: ../config.h ../lib/mbselib.h ../lib/msg.h ../lib/mbsedb.h screen.h mutil.h ledit.h grlist.h m_global.h m_node.h m_mgroup.h m_marea.h m_new.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_global.h grlist.h m_new.h m_lang.h m_marea.h m_ngroup.h m_protocol.o: ../config.h ../lib/mbselib.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_protocol.h m_ticarea.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h grlist.h m_global.h m_node.h m_fgroup.h m_farea.h m_archive.h m_ticarea.h diff --git a/mbsetup/m_marea.c b/mbsetup/m_marea.c index 41851a0b..3fe23e40 100644 --- a/mbsetup/m_marea.c +++ b/mbsetup/m_marea.c @@ -31,6 +31,8 @@ #include "../config.h" #include "../lib/mbselib.h" #include "../lib/msg.h" +#include "../lib/users.h" +#include "../lib/mbsedb.h" #include "screen.h" #include "mutil.h" #include "ledit.h" @@ -190,6 +192,7 @@ int OpenMsgarea(void) start = SYSINFO.StartDate; fclose(fin); } + InitFidonet(); sprintf(fnin, "%s/etc/mareas.data", getenv("MBSE_ROOT")); sprintf(fnout, "%s/etc/mareas.temp", getenv("MBSE_ROOT")); @@ -241,7 +244,7 @@ int OpenMsgarea(void) if ((int)msgs.Created == 0) { msgs.Created = start; if ((strlen(msgs.Newsgroup) == 0) && (msgs.Type == ECHOMAIL) && strlen(msgs.Group)) { - sprintf(msgs.Newsgroup, "%s.%s", msgs.Group, msgs.Tag); + sprintf(msgs.Newsgroup, "%s.%s", GetFidoDomain(msgs.Aka.zone), msgs.Tag); for (i = 0; i < strlen(msgs.Newsgroup); i++) { msgs.Newsgroup[i] = tolower(msgs.Newsgroup[i]); if (msgs.Newsgroup[i] == '_')