Skip to content
Snippets Groups Projects
Commit ecbf2a73 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Introduced FreeDownloadUserMsg text.dat string

Tired of being reminded that you were "awarded 0 credits"  for free downloads? I know I am, so I created another text.dat string (reusing Unused300), for notification of free-download files where no credits are awarded to the uploader. Also updated the default colors of the existing DownloadUserMsg string to have a little more variety.

Not sure why ftpsrvr.c isn't using user_downloaded_file(). That copy/pasta should be eliminated later.
parent 7723edad
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2767 passed
...@@ -783,6 +783,7 @@ static void send_thread(void* arg) ...@@ -783,6 +783,7 @@ static void send_thread(void* arg)
ultoac(mod,tmp); ultoac(mod,tmp);
} }
if(!(scfg.dir[f.dir]->misc&DIR_QUIET)) { if(!(scfg.dir[f.dir]->misc&DIR_QUIET)) {
const char* prefix = xfer.filepos ? "partially FTP-" : "FTP-";
addr_len = sizeof(addr); addr_len = sizeof(addr);
if(uploader.level>=SYSOP_LEVEL if(uploader.level>=SYSOP_LEVEL
&& getpeername(xfer.ctrl_sock,&addr.addr,&addr_len)==0 && getpeername(xfer.ctrl_sock,&addr.addr,&addr_len)==0
...@@ -791,9 +792,15 @@ static void send_thread(void* arg) ...@@ -791,9 +792,15 @@ static void send_thread(void* arg)
else else
SAFECOPY(username,xfer.user->alias); SAFECOPY(username,xfer.user->alias);
/* Inform uploader of downloaded file */ /* Inform uploader of downloaded file */
if(mod == 0)
safe_snprintf(str,sizeof(str),text[FreeDownloadUserMsg]
,getfname(xfer.filename)
,prefix
,username);
else
safe_snprintf(str,sizeof(str),text[DownloadUserMsg] safe_snprintf(str,sizeof(str),text[DownloadUserMsg]
,getfname(xfer.filename) ,getfname(xfer.filename)
,xfer.filepos ? "partially FTP-" : "FTP-" ,prefix
,username,tmp); ,username,tmp);
putsmsg(&scfg,uploader.number,str); putsmsg(&scfg,uploader.number,str);
} }
......
...@@ -310,7 +310,7 @@ enum { ...@@ -310,7 +310,7 @@ enum {
,TagFileQ ,TagFileQ
,TagFilePrompt ,TagFilePrompt
,Unused299 ,Unused299
,Unused300 ,FreeDownloadUserMsg
,FiAuthor ,FiAuthor
,FiGroup ,FiGroup
,FileAlreadyInQueue ,FileAlreadyInQueue
......
...@@ -482,7 +482,8 @@ const char * const text_defaults[TOTAL_TEXT]={ ...@@ -482,7 +482,8 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x01\x68\x01\x79\x45\x6e\x74\x65\x72\x20\x28\x73\x70\x61\x63\x65\x2d\x73\x65\x70\x61\x72\x61\x74\x65\x64\x29\x20\x54\x61\x67\x73" ,"\x01\x68\x01\x79\x45\x6e\x74\x65\x72\x20\x28\x73\x70\x61\x63\x65\x2d\x73\x65\x70\x61\x72\x61\x74\x65\x64\x29\x20\x54\x61\x67\x73"
"\x3a\x20" // 298 TagFilePrompt "\x3a\x20" // 298 TagFilePrompt
,"\x55\x4e\x55\x53\x45\x44\x32\x39\x39" // 299 Unused299 ,"\x55\x4e\x55\x53\x45\x44\x32\x39\x39" // 299 Unused299
,"\x55\x4e\x55\x53\x45\x44\x33\x30\x30" // 300 Unused300 ,"\x01\x5f\x01\x68\x01\x77\x25\x73\x01\x63\x20\x77\x61\x73\x20\x25\x73\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x65\x64\x20\x62\x79\x20\x01"
"\x77\x25\x73\x0d\x0a" // 300 FreeDownloadUserMsg
,"\x0d\x0a\x01\x6e\x01\x67\x41\x75\x74\x68\x6f\x72\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x01\x68\x20\x25\x73" // 301 FiAuthor ,"\x0d\x0a\x01\x6e\x01\x67\x41\x75\x74\x68\x6f\x72\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x01\x68\x20\x25\x73" // 301 FiAuthor
,"\x0d\x0a\x01\x6e\x01\x67\x47\x72\x6f\x75\x70\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x01\x68\x20\x25\x73" // 302 FiGroup ,"\x0d\x0a\x01\x6e\x01\x67\x47\x72\x6f\x75\x70\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x01\x68\x20\x25\x73" // 302 FiGroup
,"\x01\x77\x01\x68\x0d\x0a\x25\x73\x20\x69\x73\x20\x61\x6c\x72\x65\x61\x64\x79\x20\x69\x6e\x20\x74\x68\x65\x20\x71\x75\x65\x75\x65" ,"\x01\x77\x01\x68\x0d\x0a\x25\x73\x20\x69\x73\x20\x61\x6c\x72\x65\x61\x64\x79\x20\x69\x6e\x20\x74\x68\x65\x20\x71\x75\x65\x75\x65"
...@@ -503,9 +504,9 @@ const char * const text_defaults[TOTAL_TEXT]={ ...@@ -503,9 +504,9 @@ const char * const text_defaults[TOTAL_TEXT]={
"\x4c\x4f\x41\x44\x45\x44\x21\x01\x6e\x0d\x0a" // 309 FileZeroLength "\x4c\x4f\x41\x44\x45\x44\x21\x01\x6e\x0d\x0a" // 309 FileZeroLength
,"\x01\x5f\x01\x77\x01\x68\x25\x73\x20\x28\x25\x73\x20\x62\x79\x74\x65\x73\x29\x20\x72\x65\x63\x65\x69\x76\x65\x64\x2e\x0d\x0a" // 310 FileNBytesReceived ,"\x01\x5f\x01\x77\x01\x68\x25\x73\x20\x28\x25\x73\x20\x62\x79\x74\x65\x73\x29\x20\x72\x65\x63\x65\x69\x76\x65\x64\x2e\x0d\x0a" // 310 FileNBytesReceived
,"\x01\x5f\x01\x77\x01\x68\x25\x73\x20\x28\x25\x73\x20\x62\x79\x74\x65\x73\x29\x20\x73\x65\x6e\x74\x2e\x0d\x0a" // 311 FileNBytesSent ,"\x01\x5f\x01\x77\x01\x68\x25\x73\x20\x28\x25\x73\x20\x62\x79\x74\x65\x73\x29\x20\x73\x65\x6e\x74\x2e\x0d\x0a" // 311 FileNBytesSent
,"\x01\x5f\x01\x68\x01\x77\x25\x73\x20\x77\x61\x73\x20\x25\x73\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x65\x64\x20\x62\x79\x20\x25\x73\x0d" ,"\x01\x5f\x01\x68\x01\x77\x25\x73\x01\x63\x20\x77\x61\x73\x20\x25\x73\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x65\x64\x20\x62\x79\x20\x01"
"\x0a\x01\x6e\x01\x67\x59\x6f\x75\x20\x77\x65\x72\x65\x20\x61\x77\x61\x72\x64\x65\x64\x20\x25\x73\x20\x63\x72\x65\x64\x69\x74\x73" "\x77\x25\x73\x0d\x0a\x01\x6e\x01\x67\x59\x6f\x75\x20\x77\x65\x72\x65\x20\x61\x77\x61\x72\x64\x65\x64\x20\x01\x68\x25\x73\x01\x6e"
"\x2e\x0d\x0a" // 312 DownloadUserMsg "\x01\x67\x20\x63\x72\x65\x64\x69\x74\x73\x2e\x0d\x0a" // 312 DownloadUserMsg
,"\x70\x61\x72\x74\x69\x61\x6c\x6c\x79\x20" // 313 Partially ,"\x70\x61\x72\x74\x69\x61\x6c\x6c\x79\x20" // 313 Partially
,"\x01\x6c\x01\x6e\x01\x67\x4c\x69\x62\x72\x61\x72\x79\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x01\x68\x20\x28\x25\x75\x29\x20" ,"\x01\x6c\x01\x6e\x01\x67\x4c\x69\x62\x72\x61\x72\x79\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x01\x68\x20\x28\x25\x75\x29\x20"
"\x25\x73" // 314 FiLib "\x25\x73" // 314 FiLib
......
...@@ -2531,6 +2531,12 @@ BOOL user_downloaded_file(scfg_t* cfg, user_t* user, client_t* client, ...@@ -2531,6 +2531,12 @@ BOOL user_downloaded_file(scfg_t* cfg, user_t* user, client_t* client,
SAFECAT(prefix, "-"); SAFECAT(prefix, "-");
} }
/* Inform uploader of downloaded file */ /* Inform uploader of downloaded file */
if(mod == 0)
SAFEPRINTF3(str, cfg->text[FreeDownloadUserMsg]
,getfname(filename)
,prefix
,username);
else
SAFEPRINTF4(str, cfg->text[DownloadUserMsg] SAFEPRINTF4(str, cfg->text[DownloadUserMsg]
,getfname(filename) ,getfname(filename)
,prefix ,prefix
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment