Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 8814273d authored by rswindell's avatar rswindell

Create a 7-line MSGINF file which includes the full path to the tag file,

in scenarios where the tagfile may be used (e.g. not editing extended file
descriptions). This should allow SlyEdit and other extenal message editors
to detect the support for the editor.tag file dynamically rather than by
using the Synchronet version number. If the 7th line is blank or non-existent,
then the external editor tag file is not supported.
Overhauled editor_inf() to use a file stream/fprintf.
parent 7ec842f2
...@@ -623,7 +623,7 @@ public: ...@@ -623,7 +623,7 @@ public:
void quotemsg(smbmsg_t* msg, int tails); void quotemsg(smbmsg_t* msg, int tails);
void editmsg(smbmsg_t* msg, uint subnum); void editmsg(smbmsg_t* msg, uint subnum);
void editor_inf(int xeditnum, const char *dest, const char *title, long mode void editor_inf(int xeditnum, const char *dest, const char *title, long mode
,uint subnum); ,uint subnum, const char* tagfile);
void copyfattach(uint to, uint from, char *title); void copyfattach(uint to, uint from, char *title);
bool movemsg(smbmsg_t* msg, uint subnum); bool movemsg(smbmsg_t* msg, uint subnum);
int process_edited_text(char* buf, FILE* stream, long mode, unsigned* lines, unsigned maxlines); int process_edited_text(char* buf, FILE* stream, long mode, unsigned* lines, unsigned maxlines);
......
...@@ -444,7 +444,7 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *title, long mode ...@@ -444,7 +444,7 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *title, long mode
if(editor!=NULL) if(editor!=NULL)
*editor=cfg.xedit[useron.xedit-1]->name; *editor=cfg.xedit[useron.xedit-1]->name;
editor_inf(useron.xedit,dest,title,mode,subnum); editor_inf(useron.xedit,dest,title,mode,subnum,tagfile);
if(cfg.xedit[useron.xedit-1]->type) { if(cfg.xedit[useron.xedit-1]->type) {
gettimeleft(); gettimeleft();
xtrndat(useron.alias,cfg.node_dir,cfg.xedit[useron.xedit-1]->type xtrndat(useron.alias,cfg.node_dir,cfg.xedit[useron.xedit-1]->type
...@@ -591,24 +591,24 @@ void quotestr(char *str) ...@@ -591,24 +591,24 @@ void quotestr(char *str)
/****************************************************************************/ /****************************************************************************/
/****************************************************************************/ /****************************************************************************/
void sbbs_t::editor_inf(int xeditnum, const char *dest, const char *title, long mode void sbbs_t::editor_inf(int xeditnum, const char *dest, const char *title, long mode
,uint subnum) ,uint subnum, const char* tagfile)
{ {
char str[MAX_PATH+1]; char path[MAX_PATH+1];
char tmp[32]; char fname[32];
int file; FILE* fp;
xeditnum--; xeditnum--;
if(cfg.xedit[xeditnum]->misc&QUICKBBS) { if(cfg.xedit[xeditnum]->misc&QUICKBBS) {
strcpy(tmp,"MSGINF"); strcpy(fname,"MSGINF");
if(cfg.xedit[xeditnum]->misc&XTRN_LWRCASE) if(cfg.xedit[xeditnum]->misc&XTRN_LWRCASE)
strlwr(tmp); strlwr(fname);
SAFEPRINTF2(str,"%s%s",cfg.node_dir,tmp); SAFEPRINTF2(path,"%s%s",cfg.node_dir,fname);
if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1) { if((fp=fopen(path,"wb"))==NULL) {
errormsg(WHERE,ERR_OPEN,str,O_WRONLY|O_CREAT|O_TRUNC); errormsg(WHERE,ERR_OPEN,path,O_WRONLY|O_CREAT|O_TRUNC);
return; return;
} }
safe_snprintf(str,sizeof(str),"%s\r\n%s\r\n%s\r\n%u\r\n%s\r\n%s\r\n" fprintf(fp,"%s\r\n%s\r\n%s\r\n%u\r\n%s\r\n%s\r\n"
,(subnum!=INVALID_SUB && cfg.sub[subnum]->misc&SUB_NAME) ? useron.name ,(subnum!=INVALID_SUB && cfg.sub[subnum]->misc&SUB_NAME) ? useron.name
: useron.alias : useron.alias
,dest,title,1 ,dest,title,1
...@@ -617,27 +617,29 @@ void sbbs_t::editor_inf(int xeditnum, const char *dest, const char *title, long ...@@ -617,27 +617,29 @@ void sbbs_t::editor_inf(int xeditnum, const char *dest, const char *title, long
:subnum==INVALID_SUB ? nulstr :subnum==INVALID_SUB ? nulstr
:cfg.sub[subnum]->sname :cfg.sub[subnum]->sname
,mode&WM_PRIVATE ? "YES":"NO"); ,mode&WM_PRIVATE ? "YES":"NO");
write(file,str,strlen(str)); /* the 7th line (the tag-line file) is a Synchronet extension, for SlyEdit */
close(file); if((mode&WM_EXTDESC)==0 && tagfile!=NULL)
fprintf(fp,"%s", tagfile);
fprintf(fp,"\r\n");
fclose(fp);
} }
else { else {
SAFEPRINTF(str,"%sRESULT.ED",cfg.node_dir); SAFEPRINTF(path,"%sRESULT.ED",cfg.node_dir);
removecase(str); removecase(path);
strcpy(tmp,"EDITOR.INF"); strcpy(fname,"EDITOR.INF");
if(cfg.xedit[xeditnum]->misc&XTRN_LWRCASE) if(cfg.xedit[xeditnum]->misc&XTRN_LWRCASE)
strlwr(tmp); strlwr(fname);
SAFEPRINTF2(str,"%s%s",cfg.node_dir,tmp); SAFEPRINTF2(path,"%s%s",cfg.node_dir,fname);
if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1) { if((fp=fopen(path,"wb"))==NULL) {
errormsg(WHERE,ERR_OPEN,str,O_WRONLY|O_CREAT|O_TRUNC); errormsg(WHERE,ERR_OPEN,path,O_WRONLY|O_CREAT|O_TRUNC);
return; return;
} }
safe_snprintf(str,sizeof(str),"%s\r\n%s\r\n%u\r\n%s\r\n%s\r\n%u\r\n" fprintf(fp,"%s\r\n%s\r\n%u\r\n%s\r\n%s\r\n%u\r\n"
,title,dest,useron.number ,title,dest,useron.number
,(subnum!=INVALID_SUB && cfg.sub[subnum]->misc&SUB_NAME) ? useron.name ,(subnum!=INVALID_SUB && cfg.sub[subnum]->misc&SUB_NAME) ? useron.name
: useron.alias : useron.alias
,useron.name,useron.level); ,useron.name,useron.level);
write(file,str,strlen(str)); fclose(fp);
close(file);
} }
} }
...@@ -1026,7 +1028,7 @@ bool sbbs_t::editfile(char *fname, bool msg) ...@@ -1026,7 +1028,7 @@ bool sbbs_t::editfile(char *fname, bool msg)
fcopy(path, msgtmp); fcopy(path, msgtmp);
} }
editor_inf(useron.xedit,fname,nulstr,0,INVALID_SUB); editor_inf(useron.xedit,fname,nulstr,0,INVALID_SUB,/* tagfile: */NULL);
if(cfg.xedit[useron.xedit-1]->misc&XTRN_NATIVE) if(cfg.xedit[useron.xedit-1]->misc&XTRN_NATIVE)
mode|=EX_NATIVE; mode|=EX_NATIVE;
if(cfg.xedit[useron.xedit-1]->misc&XTRN_SH) if(cfg.xedit[useron.xedit-1]->misc&XTRN_SH)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment